The Samba-Bugzilla – Attachment 8163 Details for
Bug 9357
exposes more symbols than specified by abi_match setting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patches for v4-0-test
tmp40.diff (text/plain), 8.94 KB, created by
Stefan Metzmacher
on 2012-11-07 11:40:38 UTC
(
hide
)
Description:
Patches for v4-0-test
Filename:
MIME Type:
Creator:
Stefan Metzmacher
Created:
2012-11-07 11:40:38 UTC
Size:
8.94 KB
patch
obsolete
>From 676b8e9bcfb7c04de7771a18c325ea9508120875 Mon Sep 17 00:00:00 2001 >From: Jelmer Vernooij <jelmer@samba.org> >Date: Mon, 5 Nov 2012 19:36:28 +0100 >Subject: [PATCH 1/4] wafsamba.samba_abi: Refactor abi_write_vscript to take > file argument. > >Signed-off-by: Andrew Bartlett <abartlet@samba.org> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >Reviewed-by: Stephen Gallagher <sgallagh@redhat.com> >(cherry picked from commit ea5ef95fbebe28cca11f86a9015aab77522f5e18) >--- > buildtools/wafsamba/samba_abi.py | 22 +++++++++++++--------- > 1 file changed, 13 insertions(+), 9 deletions(-) > >diff --git a/buildtools/wafsamba/samba_abi.py b/buildtools/wafsamba/samba_abi.py >index ed977ba..d3852ea 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: >@@ -197,7 +198,6 @@ def abi_write_vscript(vscript, libname, current_version, versions, symmap, abi_m > elif abi_match != ["*"]: > f.write("\tlocal: *;\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): >-- >1.7.9.5 > > >From 1a3a54e43a7c361aea38d837a28ca3fdc7388950 Mon Sep 17 00:00:00 2001 >From: Andrew Bartlett <abartlet@samba.org> >Date: Tue, 6 Nov 2012 07:48:52 +1100 >Subject: [PATCH 2/4] 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@samba.org> >Reviewed-by: Jelmer Vernooij <jelmer@samba.org> > >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >(cherry picked from commit 97102fa9963ba88f4ab72165a02071990031a73b) >--- > buildtools/wafsamba/samba_abi.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/buildtools/wafsamba/samba_abi.py b/buildtools/wafsamba/samba_abi.py >index d3852ea..eb53f8c 100644 >--- a/buildtools/wafsamba/samba_abi.py >+++ b/buildtools/wafsamba/samba_abi.py >@@ -177,7 +177,7 @@ def abi_write_vscript(f, libname, current_version, versions, symmap, abi_match): > break > f.write("%s {\n" % symver) > if k in invmap: >- f.write("\tglobal: \n") >+ f.write("\tglobal:\n") > for s in invmap.get(k, []): > f.write("\t\t%s;\n" % s); > f.write("}%s;\n\n" % last_key) >-- >1.7.9.5 > > >From e23ae906a961bd09eeeaaf05ade19586ea9e16cc Mon Sep 17 00:00:00 2001 >From: Jelmer Vernooij <jelmer@samba.org> >Date: Mon, 5 Nov 2012 19:36:29 +0100 >Subject: [PATCH 3/4] wafsamba.samba_abi: Add basic unit tests. > >Signed-off-by: Andrew Bartlett <abartlet@samba.org> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >Reviewed-by: Stephen Gallagher <sgallagh@redhat.com> >(cherry picked from commit d02c8ba122cef7d8b254e5be3ae757eb3bb14235) >--- > buildtools/wafsamba/samba_abi.py | 2 +- > buildtools/wafsamba/tests/test_abi.py | 50 +++++++++++++++++++++++++++++++++ > 2 files changed, 51 insertions(+), 1 deletion(-) > >diff --git a/buildtools/wafsamba/samba_abi.py b/buildtools/wafsamba/samba_abi.py >index eb53f8c..c325b33 100644 >--- a/buildtools/wafsamba/samba_abi.py >+++ b/buildtools/wafsamba/samba_abi.py >@@ -176,7 +176,7 @@ def abi_write_vscript(f, libname, current_version, versions, symmap, abi_match): > if symver == current_version: > break > f.write("%s {\n" % symver) >- if k in invmap: >+ if k in sorted(invmap.keys()): > f.write("\tglobal:\n") > for s in invmap.get(k, []): > f.write("\t\t%s;\n" % s); >diff --git a/buildtools/wafsamba/tests/test_abi.py b/buildtools/wafsamba/tests/test_abi.py >index 0aa0d56..42c4697 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,50 @@ 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_*; >+}; >+""") >-- >1.7.9.5 > > >From b6817489f8043cfa48bf0d5ca63a16953507d73f Mon Sep 17 00:00:00 2001 >From: Jelmer Vernooij <jelmer@samba.org> >Date: Mon, 5 Nov 2012 19:36:30 +0100 >Subject: [PATCH 4/4] 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@samba.org> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >Reviewed-by: Stephen Gallagher <sgallagh@redhat.com> >(cherry picked from commit ec3cbb6c476698523c9b5ac047787df101746891) >--- > buildtools/wafsamba/samba_abi.py | 6 +++--- > buildtools/wafsamba/tests/test_abi.py | 17 +++++++++++++++++ > 2 files changed, 20 insertions(+), 3 deletions(-) > >diff --git a/buildtools/wafsamba/samba_abi.py b/buildtools/wafsamba/samba_abi.py >index c325b33..488dab8 100644 >--- a/buildtools/wafsamba/samba_abi.py >+++ b/buildtools/wafsamba/samba_abi.py >@@ -191,12 +191,12 @@ def abi_write_vscript(f, libname, current_version, versions, symmap, abi_match): > 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") > > >diff --git a/buildtools/wafsamba/tests/test_abi.py b/buildtools/wafsamba/tests/test_abi.py >index 42c4697..bba78c1 100644 >--- a/buildtools/wafsamba/tests/test_abi.py >+++ b/buildtools/wafsamba/tests/test_abi.py >@@ -101,3 +101,20 @@ MYLIB_0.1 { > \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*; >+}; >+""") >-- >1.7.9.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
metze
:
review?
(
jelmer
)
Actions:
View
Attachments on
bug 9357
: 8163