[git] GPGME - branch, master, updated. gpgme-1.10.0-192-gbbfa7c4

by Tobias Mueller cvs at cvs.gnupg.org
Tue Apr 17 10:30:03 CEST 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, master has been updated
       via  bbfa7c42337bb619e6af20bf051fe0755ed5a9fd (commit)
      from  4bba3b8e2c350b8ff0d562ec63cc03a096448d84 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit bbfa7c42337bb619e6af20bf051fe0755ed5a9fd
Author: Tobias Mueller <muelli at cryptobitch.de>
Date:   Tue Feb 20 17:34:14 2018 +0100

    python: Fix crash by leaving struct members intact
    
    * lang/python/setup.py.in: Copy gpgme.h instead of parsing it.
    --
    The python bindings tried to parse deprecated functions
    out of gpgme.h. This fails for the current gpgme.h in
    that it removes an entire field in the key sig struct (_obsolete_class).
    Hence, the fields were off by an int and the bindings accessed struct
    members via the wrong offset. That caused python program to crash.
    At least on 32bit platforms, the crash can be easily triggered by
    accessing key.uids[0].signatures. On 64bit platforms the compiler
    probably aligns the struct so that the missing 4 bytes are not noticed.
    
    With this change, the python bindings will expose all functions
    that gpgme exposes, including the deprecated ones.
    
    Credits go to Justus Winter for debugging and identying the issue.
    
    Signed-off-by: Tobias Mueller <muelli at cryptobitch.de>
    GnuPG-bug-id: 3892

diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in
index f9dda20..2595073 100755
--- a/lang/python/setup.py.in
+++ b/lang/python/setup.py.in
@@ -152,25 +152,8 @@ class BuildExtFirstHack(build):
             sink.write(content)
 
     def _generate_gpgme_h(self, source_name, sink_name):
-        if up_to_date(source_name, sink_name):
-            return
-
         print("Using gpgme.h from {}".format(source_name))
-
-        deprec_func = re.compile(r'^(.*typedef.*|.*\(.*\)|[^#]+\s+.+)'
-                                 + r'\s*_GPGME_DEPRECATED(_OUTSIDE_GPGME)?\(.*\);\s*',
-                                 re.S)
-        line_break = re.compile(';|\\$|\\x0c|^\s*#|{')
-
-        with open(sink_name, "w") as sink, open(source_name) as source:
-            text = ''
-            for line in source:
-                text += re.sub(' class ', ' _py_obsolete_class ', line)
-                if line_break.search(line):
-                    if not deprec_func.search(text):
-                        sink.write(text)
-                    text = ''
-            sink.write(text)
+        shutil.copy2(source_name, sink_name)
 
     def _generate_errors_i(self):
 

-----------------------------------------------------------------------

Summary of changes:
 lang/python/setup.py.in | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list