[csw-devel] SF.net SVN: gar:[13309] csw/mgar/gar/v2/lib/python

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Mon Feb 14 21:29:42 CET 2011


Revision: 13309
          http://gar.svn.sourceforge.net/gar/?rev=13309&view=rev
Author:   wahwah
Date:     2011-02-14 20:29:41 +0000 (Mon, 14 Feb 2011)

Log Message:
-----------
checkpkg: soname must not equal filename

Add a check for a failure mode that once happened to libnet, where the
soname and the filename are identical, and the filename ends with .so.

Such condition makes any subsequent updates very hard.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/package_checks.py
    csw/mgar/gar/v2/lib/python/package_checks_test.py

Modified: csw/mgar/gar/v2/lib/python/package_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks.py	2011-02-14 20:29:05 UTC (rev 13308)
+++ csw/mgar/gar/v2/lib/python/package_checks.py	2011-02-14 20:29:41 UTC (rev 13309)
@@ -1225,7 +1225,24 @@
 
 def CheckSonameMustNotBeEqualToFileNameIfFilenameEndsWithSo(
     pkg_data, error_mgr, logger, messenger):
-  pass
+  for binary_info in pkg_data["binaries_dump_info"]:
+    soname = binary_info["soname"]
+    base_name = binary_info["base_name"]
+    if (base_name.endswith(".so")
+        and soname == base_name):
+      msg = ("File /%s is a shared library.  Its SONAME is equal to its "
+             "filename, and the filename ends with .so. "
+             "This is a serious problem. "
+             "If such shared library is released and any programs link "
+             "to it, it is very hard to do any subsequent updates to "
+             "that shared library.  This problem has occurred with relation "
+             "to libnet. "
+             "For information how to update such library, please see: "
+             "http://wiki.opencsw.org/project-libnet")
+      messenger.Message(msg)
+      error_mgr.ReportError(
+          "soname-equals-filename",
+          "file=/%s" % binary_info["path"])
 
 
 def CheckLinkableSoFileMustBeAsymlink(

Modified: csw/mgar/gar/v2/lib/python/package_checks_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_test.py	2011-02-14 20:29:05 UTC (rev 13308)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py	2011-02-14 20:29:41 UTC (rev 13309)
@@ -1655,5 +1655,28 @@
     self.RunCheckpkgTest(self.CheckpkgTest4)
 
 
+class TestCheckPrefixDirs(CheckpkgUnitTestHelper,
+                          unittest.TestCase):
+  FUNCTION_NAME = ('CheckSonameMustNotBeEqualToFileName'
+                   'IfFilenameEndsWithSo')
+
+  def CheckpkgTest(self):
+    self.pkg_data = copy.deepcopy(neon_stats[0])
+    self.pkg_data["binaries_dump_info"][0]["soname"] = "libfoo.so"
+    self.pkg_data["binaries_dump_info"][0]["base_name"] = "libfoo.so"
+    self.pkg_data["binaries_dump_info"][0]["path"] = "opt/csw/lib/libfoo.so"
+    self.error_mgr_mock.ReportError(
+        'soname-equals-filename',
+        'file=/opt/csw/lib/libfoo.so')
+
+  def CheckpkgTest2(self):
+    self.pkg_data = copy.deepcopy(neon_stats[0])
+    self.pkg_data["binaries_dump_info"][0]["soname"] = "libfoo.so.1"
+    self.pkg_data["binaries_dump_info"][0]["base_name"] = "libfoo.so.1"
+
+  def testTwo(self):
+    self.RunCheckpkgTest(self.CheckpkgTest2)
+
+
 if __name__ == '__main__':
   unittest.main()


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list