[PATCHES] fix NTSTATUS error table creation script
Günther Deschner
gd at samba.org
Wed Sep 30 16:51:26 UTC 2015
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
please review and push.
Thanks,
Guenther
- --
Günther Deschner GPG-ID: 8EE11688
Red Hat gdeschner at redhat.com
Samba Team gd at samba.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iEYEARECAAYFAlYMEwYACgkQSOk3aI7hFoh4GQCfW/oSB1UzeWEgaU288a4ZDUxV
zzgAniC65JPLTLHpuFEL+AzCg9SPlrnE
=S5kw
-----END PGP SIGNATURE-----
-------------- next part --------------
From c4e0fa7e50e3e7a1c0773d11e1cf1bc85ee6d957 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Wed, 30 Sep 2015 08:14:06 +0200
Subject: [PATCH 1/2] s4-scripting: fix wrong indent that caused
gen_ntstatus.py to fail.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Verified it now works again with:
./source4/scripting/bin/gen_ntstatus.py libcli/util/ntstatus.h MS-ERREF-2.3.1.NTSTATUS libcli/util/nterr.c
MS-ERREF-2.3.1.NTSTATUS as the copied content from
https://msdn.microsoft.com/en-us/library/cc704588.aspx.
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
---
source4/scripting/bin/gen_ntstatus.py | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/source4/scripting/bin/gen_ntstatus.py b/source4/scripting/bin/gen_ntstatus.py
index 3625ad7..bf57fef 100755
--- a/source4/scripting/bin/gen_ntstatus.py
+++ b/source4/scripting/bin/gen_ntstatus.py
@@ -62,6 +62,8 @@ def transformErrorName( error_name ):
def parseErrorDescriptions( file_contents, isWinError ):
count = 0
for line in file_contents:
+ if line == None or line == '\t' or line == "" or line == '\n':
+ continue
content = line.strip().split(None,1)
# start new error definition ?
if line.startswith("0x"):
@@ -78,17 +80,17 @@ def parseErrorDescriptions( file_contents, isWinError ):
print "Error parsing file as line %d"%count
sys.exit()
err = Errors[-1]
- if err.err_define == None:
+ if err.err_define == None:
err.err_define = transformErrorName(content[0])
- else:
- if len(content) > 0:
- desc = escapeString(line.strip())
- if len(desc):
- if err.err_string == "":
- err.err_string = desc
- else:
- err.err_string = err.err_string + " " + desc
- count = count + 1
+ else:
+ if len(content) > 0:
+ desc = escapeString(line.strip())
+ if len(desc):
+ if err.err_string == "":
+ err.err_string = desc
+ else:
+ err.err_string = err.err_string + " " + desc
+ count = count + 1
print "parsed %d lines generated %d error definitions"%(count,len(Errors))
def parseErrCodeString(error_code_string):
@@ -147,21 +149,21 @@ def generateSourceFile(out_file):
out_file.write(" * [MS-ERREF] http://msdn.microsoft.com/en-us/library/cc704588.aspx\n")
out_file.write(" */\n")
for err in ErrorsToCreatDescFor:
- out_file.write(" { N_(\"%s\"), %s },\n"%(err.err_string, err.err_define))
+ out_file.write(" { N_(\"%s\"), %s },\n"%(err.err_string, err.err_define))
out_file.write("\n\n")
out_file.write("/*\n")
out_file.write(" * New descriptions for new errors generated from\n")
out_file.write(" * [MS-ERREF] http://msdn.microsoft.com/en-us/library/cc704588.aspx\n")
out_file.write(" */\n")
for err in ErrorsToUse:
- out_file.write(" { N_(\"%s\"), %s },\n"%(err.err_string, err.err_define))
+ out_file.write(" { N_(\"%s\"), %s },\n"%(err.err_string, err.err_define))
out_file.write("\n\n");
out_file.write("/*\n")
out_file.write(" * New descriptions for new errors generated from\n")
out_file.write(" * [MS-ERREF] http://msdn.microsoft.com/en-us/library/cc704588.aspx\n")
out_file.write(" */\n")
for err in ErrorsToUse:
- out_file.write(" { \"%s\", %s },\n"%(err.err_define, err.err_define))
+ out_file.write(" { \"%s\", %s },\n"%(err.err_define, err.err_define))
def def_in_list(define, err_def_with_desc):
for item in err_def_with_desc:
@@ -231,9 +233,11 @@ def main ():
file_contents = open(input_file3,"r")
has_already_desc = file_contents.readlines()
processErrorDescription(has_already_desc)
+ print "writing new headerfile: %s"%headerfile_name
out_file = open(headerfile_name,"w")
generateHeaderFile(out_file)
out_file.close()
+ print "writing new headerfile: %s"%sourcefile_name
out_file = open(sourcefile_name,"w")
generateSourceFile(out_file)
out_file.close()
--
2.4.3
From f0be5a769c33ab1d0fdaa483d95ebbaebafd72b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Wed, 30 Sep 2015 08:27:04 +0200
Subject: [PATCH 2/2] s4-scripting: fix minor indent issue for hresult
generation.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
---
source4/scripting/bin/gen_hresult.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source4/scripting/bin/gen_hresult.py b/source4/scripting/bin/gen_hresult.py
index 24d96c4..176c89d 100755
--- a/source4/scripting/bin/gen_hresult.py
+++ b/source4/scripting/bin/gen_hresult.py
@@ -66,7 +66,7 @@ def parseErrorDescriptions( input_file, isWinError ):
err = Errors[-1]
if err.err_define == None:
err.err_define = "HRES_" + content[0]
- else:
+ else:
if len(content) > 0:
desc = escapeString(line.strip())
if len(desc):
--
2.4.3
More information about the samba-technical
mailing list