Escalated to Bugzilla from IssueTracker
Event posted on 08-10-2009 01:17pm EDT by savas Most patch zip files contain the directory as part of the zip file: [savas@nhuudlm43 savas]$ unzip -l 121692-01.zip.fixed Archive: 121692-01.zip.fixed Length Date Time Name -------- ---- ---- ---- 0 08-04-09 09:18 121692-01/ ...snip... Solaris2mpm looks at the unzip output ang gets the directory from the 4th field of the fourth line. In the zip file solaris2mpm expects that to be the directory. In this patch, however it looks like this: [savas@nhuudlm43 savas]$ unzip -l 121692-01.zip Archive: 121692-01.zip Length Date Time Name -------- ---- ---- ---- 3159237 10-05-06 16:05 121692-01/802-3233-25.ps Which is the name of a file in the patch. solaris2mpm will barf with the following error: solaris2mpm 121692-01.zip Opening archive, this may take a while Error creating mpm for /tmp/121692-01.zip: Traceback (most recent call last): File "/opt/redhat/rhn/solaris/lib/python2.4/site-packages/rhnpush/solaris2mpm.py", line 184, in _run archive_parser = get_archive_parser(archive, tempdir=options.TEMPDIR) File "/opt/redhat/rhn/solaris/lib/python2.4/site-packages/rhnpush/archive.py", line 408, in get_archive_parser return Class(archive, tempdir) File "/opt/redhat/rhn/solaris/lib/python2.4/site-packages/rhnpush/archive.py", line 53, in __init__ self._explode(archive) File "/opt/redhat/rhn/solaris/lib/python2.4/site-packages/rhnpush/archive.py", line 105, in _explode raise InvalidArchiveError("Archive did not expand to %s" % self._archive_dir) InvalidArchiveError: Archive did not expand to /tmp/tmpq6_RmT/121692-01/802-3233-25.p The easy solution is to re-zip the patch so that it has the directory in the zip file. However this isn't scalable. Another fix is to update the archive.py file. Below is a patch I created to fix this issue. The TODO is there because there is the potential that the first file in the zip file may be another directory. Since we only want the first directory my patch won't work. bash-3.00# diff -u /opt/redhat/rhn/solaris/lib/python2.4/site-packages/rhnpush/archive.py /opt/redhat/rhn/solaris/lib/python2.4/site-packages/rhnpush/archive.py.new --- /opt/redhat/rhn/solaris/lib/python2.4/site-packages/rhnpush/archive.py Mon Aug 10 13:11:25 2009 +++ /opt/redhat/rhn/solaris/lib/python2.4/site-packages/rhnpush/archive.py.new Mon Aug 10 13:11:21 2009 @@ -241,6 +241,12 @@ raise ArchiveException("cannot open %s, 'unzip' not found" % self._archive) self._archive_dir = os.path.join(self._temp_dir, self._get_archive_dir()) + # Some patches (121692-01) don't zip the entire directory. Some only + # zip the contents. In that case get a dirname of the first element + # TODO: A better way might be to regex the filename from the beginning + # the first / and return that from _get_archive_dir + if not os.path.isdir( self._archive_dir ): + self._archive_dir = os.path.dirname( self._archive_dir ) return "unzip -q -n %s -d %s" % (self._archive, self._temp_dir) This event sent from IssueTracker by xdmoon [Support Engineering Group] issue 328399
Created attachment 386000 [details] requested sun patch file
Fixed in spacewalk git. Commit: e643c0d5df922f5b9b7edd8db647cad970c970dd
Cherry picked to satellite.git as commit bea21105b9fa95750ea054c5a9c848a57cc99f79
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: When processing ZIP archives, the solaris2mpm utility no longer fails if the patch is not placed in a directory.