[SCM] Samba Shared Repository - branch v4-0-test updated

Karolin Seeger kseeger at samba.org
Fri Nov 9 06:20:03 MST 2012


The branch, v4-0-test has been updated
       via  2f05e8c WHATSNEW: Update changes since rc4.
       via  69cb802 wafsamba.abi: Fix abi_match with both excludes and includes.
       via  a3d7af1 wafsamba.samba_abi: Add basic unit tests.
       via  d280533 buildtools: Remove extra space from global: line
       via  e443b2d wafsamba.samba_abi: Refactor abi_write_vscript to take file argument.
      from  e3a35dc WHATSNEW: Update changes since rc4.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit 2f05e8c8089fe7d5746b5a4a46e8d9332624dca1
Author: Karolin Seeger <kseeger at samba.org>
Date:   Fri Nov 9 12:33:56 2012 +0100

    WHATSNEW: Update changes since rc4.
    
    Karolin
    
    Autobuild-User(v4-0-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-0-test): Fri Nov  9 14:19:31 CET 2012 on sn-devel-104

commit 69cb8022e5e4fe089e287abe3b38300645c12bb1
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Nov 5 19:36:30 2012 +0100

    wafsamba.abi: Fix abi_match with both excludes and includes.
    
    This fixes a regression introduced by 9c3e294400234ebdf9b98031bae583524fd0b0ac
    which caused internal symbols in libldb to be exposed.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=9357
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Stephen Gallagher <sgallagh at redhat.com>
    (cherry picked from commit ec3cbb6c476698523c9b5ac047787df101746891)

commit a3d7af142b5113f96c0efb0eff1abb0b846e7dc8
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Nov 5 19:36:29 2012 +0100

    wafsamba.samba_abi: Add basic unit tests.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Stephen Gallagher <sgallagh at redhat.com>
    (cherry picked from commit d02c8ba122cef7d8b254e5be3ae757eb3bb14235)

commit d280533c2fd3d27ebb15adb35751ae06ce256a42
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Nov 6 07:48:52 2012 +1100

    buildtools: Remove extra space from global: line
    
    This makes it easier to put the expected values in a file
    as we will not have trailing whitespace that is against git style.
    
    Andrew Bartlett
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Jelmer Vernooij <jelmer at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 97102fa9963ba88f4ab72165a02071990031a73b)

commit e443b2d782043de5492a91025ec08a4734f58ed5
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Nov 5 19:36:28 2012 +0100

    wafsamba.samba_abi: Refactor abi_write_vscript to take file argument.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Stephen Gallagher <sgallagh at redhat.com>
    (cherry picked from commit ea5ef95fbebe28cca11f86a9015aab77522f5e18)

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

Summary of changes:
 WHATSNEW.txt                          |    5 ++
 buildtools/wafsamba/samba_abi.py      |   32 +++++++++-------
 buildtools/wafsamba/tests/test_abi.py |   67 +++++++++++++++++++++++++++++++++
 3 files changed, 90 insertions(+), 14 deletions(-)


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 9d9cd02..72b90e9 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -187,6 +187,7 @@ o   Andrew Bartlett <abartlet at samba.org>
     * BUG 9347: winbind: Extend wbcAuthenticateUserEx to provide PAC.
     * BUG 9352: Fix samba crashes with certain RPC calls.
     * BUG 9355: Set mask values to 0777 and use fileserver.conf.
+    * BUG 9357: Don't expose more symbols than specified by abi_match setting.
 
 
 o   Björn Baumbach <bb at sernet.de>
@@ -238,6 +239,10 @@ o   Andreas Schneider <asn at samba.org>
     * BUG 9339: Build and quota fixes.
 
 
+o   Jelmer Vernooij <jelmer at samba.org>
+    * BUG 9357: Don't expose more symbols than specified by abi_match setting.
+
+
 CHANGES SINCE 4.0.0rc3
 ======================
 
diff --git a/buildtools/wafsamba/samba_abi.py b/buildtools/wafsamba/samba_abi.py
index ed977ba..488dab8 100644
--- a/buildtools/wafsamba/samba_abi.py
+++ b/buildtools/wafsamba/samba_abi.py
@@ -152,22 +152,23 @@ def abi_process_file(fname, version, symmap):
             symmap[symname] = version
     f.close()
 
-def abi_write_vscript(vscript, libname, current_version, versions, symmap, abi_match):
-    '''write a vscript file for a library in --version-script format
 
-    :param vscript: Path to the vscript file
+def abi_write_vscript(f, libname, current_version, versions, symmap, abi_match):
+    """Write a vscript file for a library in --version-script format.
+
+    :param f: File-like object to write to
     :param libname: Name of the library, uppercased
     :param current_version: Current version
     :param versions: Versions to consider
     :param symmap: Dictionary mapping symbols -> version
-    :param abi_match: List of symbols considered to be public in the current version
-    '''
+    :param abi_match: List of symbols considered to be public in the current
+        version
+    """
 
     invmap = {}
     for s in symmap:
         invmap.setdefault(symmap[s], []).append(s)
 
-    f = open(vscript, mode='w')
     last_key = ""
     versions = sorted(versions, key=version_key)
     for k in versions:
@@ -175,8 +176,8 @@ def abi_write_vscript(vscript, libname, current_version, versions, symmap, abi_m
         if symver == current_version:
             break
         f.write("%s {\n" % symver)
-        if k in invmap:
-            f.write("\tglobal: \n")
+        if k in sorted(invmap.keys()):
+            f.write("\tglobal:\n")
             for s in invmap.get(k, []):
                 f.write("\t\t%s;\n" % s);
         f.write("}%s;\n\n" % last_key)
@@ -190,14 +191,13 @@ def abi_write_vscript(vscript, libname, current_version, versions, symmap, abi_m
             f.write("\t\t%s;\n" % x)
     else:
         f.write("\t\t*;\n")
-    if len(local_abi) > 0:
+    if abi_match != ["*"]:
         f.write("\tlocal:\n")
         for x in local_abi:
             f.write("\t\t%s;\n" % x[1:])
-    elif abi_match != ["*"]:
-        f.write("\tlocal: *;\n")
+        if len(global_abi) > 0:
+            f.write("\t\t*;\n")
     f.write("};\n")
-    f.close()
 
 
 def abi_build_vscript(task):
@@ -213,8 +213,12 @@ def abi_build_vscript(task):
         version = basename[len(task.env.LIBNAME)+1:-len(".sigs")]
         versions.append(version)
         abi_process_file(fname, version, symmap)
-    abi_write_vscript(tgt, task.env.LIBNAME, task.env.VERSION, versions, symmap,
-                      task.env.ABI_MATCH)
+    f = open(tgt, mode='w')
+    try:
+        abi_write_vscript(f, task.env.LIBNAME, task.env.VERSION, versions,
+            symmap, task.env.ABI_MATCH)
+    finally:
+        f.close()
 
 
 def ABI_VSCRIPT(bld, libname, abi_directory, version, vscript, abi_match=None):
diff --git a/buildtools/wafsamba/tests/test_abi.py b/buildtools/wafsamba/tests/test_abi.py
index 0aa0d56..bba78c1 100644
--- a/buildtools/wafsamba/tests/test_abi.py
+++ b/buildtools/wafsamba/tests/test_abi.py
@@ -17,9 +17,12 @@
 from wafsamba.tests import TestCase
 
 from wafsamba.samba_abi import (
+    abi_write_vscript,
     normalise_signature,
     )
 
+from cStringIO import StringIO
+
 
 class NormaliseSignatureTests(TestCase):
 
@@ -51,3 +54,67 @@ class NormaliseSignatureTests(TestCase):
             'uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\\237\\350", node = "\\b\\000+\\020H`"}, if_version = 2',
             normalise_signature('$244 = {uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\\237\\350", node = "\\b\\000+\\020H`"}, if_version = 2}'))
 
+
+class WriteVscriptTests(TestCase):
+
+    def test_one(self):
+        f = StringIO()
+        abi_write_vscript(f, "MYLIB", "1.0", [], {
+            "old": "1.0",
+            "new": "1.0"}, ["*"])
+        self.assertEquals(f.getvalue(), """\
+1.0 {
+\tglobal:
+\t\t*;
+};
+""")
+
+    def test_simple(self):
+        # No restrictions.
+        f = StringIO()
+        abi_write_vscript(f, "MYLIB", "1.0", ["0.1"], {
+            "old": "0.1",
+            "new": "1.0"}, ["*"])
+        self.assertEquals(f.getvalue(), """\
+MYLIB_0.1 {
+\tglobal:
+\t\told;
+};
+
+1.0 {
+\tglobal:
+\t\t*;
+};
+""")
+
+    def test_exclude(self):
+        f = StringIO()
+        abi_write_vscript(f, "MYLIB", "1.0", [], {
+            "exc_old": "0.1",
+            "old": "0.1",
+            "new": "1.0"}, ["!exc_*"])
+        self.assertEquals(f.getvalue(), """\
+1.0 {
+\tglobal:
+\t\t*;
+\tlocal:
+\t\texc_*;
+};
+""")
+
+    def test_excludes_and_includes(self):
+        f = StringIO()
+        abi_write_vscript(f, "MYLIB", "1.0", [], {
+            "pub_foo": "1.0",
+            "exc_bar": "1.0",
+            "other": "1.0"
+            }, ["pub_*", "!exc_*"])
+        self.assertEquals(f.getvalue(), """\
+1.0 {
+\tglobal:
+\t\tpub_*;
+\tlocal:
+\t\texc_*;
+\t\t*;
+};
+""")


-- 
Samba Shared Repository


More information about the samba-cvs mailing list