LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   [Request] Info-Zip UID/GID and bzip2 support for -current (http://www.linuxquestions.org/questions/slackware-14/%5Brequest%5D-info-zip-uid-gid-and-bzip2-support-for-current-4175476829/)

ruario 09-12-2013 04:00 AM

[Request] Info-Zip UID/GID and bzip2 support for -current
 
As you can see in this thread on the Info-Zip forums, UID/GID restoration is broken by default (that thread also includes a patch, as does this Debian bug report). Could this be fixed in -current?

As an additional request, it would be nice if bzip2 compression support was added to the Slackware infozip package by default as I have started to encounter more zips that use this method from Windows using friends. No other application included in Slackware can currently open these files so without support in the official Slackware package a user must either recompile infozip themselves or install pz7ip from SBo.

When recompiling infozip recently with bzip2 support I made the following change to the infozip.SlackBuild and dumped the bzip2-1.0.6.tar.gz in the directory alongside it.

Code:

--- infozip.SlackBuild.orig    2013-09-11 10:38:17.000000000 +0200
+++ infozip.SlackBuild  2013-09-11 10:39:55.000000000 +0200
@@ -45,6 +45,10 @@
 rm -rf zip$(echo $ZIP | tr -d .)
 tar xvf $CWD/zip$(echo $ZIP | tr -d .).tar.?z* || exit 1
 cd zip$(echo $ZIP | tr -d .)
+if /bin/ls $CWD/bzip2-*.tar.gz &> /dev/null; then
+  tar xf $CWD/bzip2-*.tar.gz -C bzip2 --strip 1 || exit 1
+  BZ2SUPPORT="IZ_BZIP2=$(pwd)/bzip2"
+fi
 chown -R root:root .
 mkdir -p $PKG/usr/doc/zip-$ZIP
 cp -a BUGS CHANGES INSTALL LICENSE README* TODO US* WHATSNEW WHERE \
@@ -70,7 +74,7 @@
 cp -a BUGS COPYING* Contents History.* INSTALL LICENSE README ToDo WHERE \
      $PKG/usr/doc/unzip-$VERSION
 chmod 644 $PKG/usr/doc/unzip-$VERSION/*
-make -f unix/Makefile generic || exit 1
+make -f unix/Makefile generic $BZ2SUPPORT || exit 1
 cat unzip > $PKG/usr/bin/unzip
 cat unzipsfx > $PKG/usr/bin/unzipsfx
 cat funzip > $PKG/usr/bin/funzip

There is probably a neater way to add support, though in my own testing I was not able to use bzlib.h and libbz2.a from the Slackware bzip2 package as libbz2.a was not built with BZ_NO_STDIO (Zip prefers this and UnZip requires it to add bzip2 compression support).

P.S. There is also this thread started by me on the UID/GID problems, here in LQ).

ruario 09-12-2013 05:21 AM

Here is a patch to infozip.SlackBuild that adds working Unix UID/GID support and bzip2 support:

Code:

--- ./infozip.SlackBuild.orig  2013-09-12 11:19:30.000000000 +0200
+++ ./infozip.SlackBuild        2013-09-12 11:15:28.000000000 +0200
@@ -45,6 +45,10 @@
 rm -rf zip$(echo $ZIP | tr -d .)
 tar xvf $CWD/zip$(echo $ZIP | tr -d .).tar.?z* || exit 1
 cd zip$(echo $ZIP | tr -d .)
+if /bin/ls $CWD/bzip2-*.tar.gz &> /dev/null; then
+  tar xf $CWD/bzip2-*.tar.gz -C bzip2 --strip 1 || exit 1
+  BZ2SUPPORT="IZ_BZIP2=$(pwd)/bzip2"
+fi
 chown -R root:root .
 mkdir -p $PKG/usr/doc/zip-$ZIP
 cp -a BUGS CHANGES INSTALL LICENSE README* TODO US* WHATSNEW WHERE \
@@ -65,12 +69,13 @@
 rm -rf unzip$(echo $VERSION | tr -d .)
 tar xvf $CWD/unzip$(echo $VERSION | tr -d .).tar.?z* || exit 1
 cd unzip$(echo $VERSION | tr -d .)
+zcat < $CWD/process.c.diff.gz | patch -p1 || exit
 chown -R root:root .
 mkdir -p $PKG/usr/doc/unzip-$VERSION
 cp -a BUGS COPYING* Contents History.* INSTALL LICENSE README ToDo WHERE \
      $PKG/usr/doc/unzip-$VERSION
 chmod 644 $PKG/usr/doc/unzip-$VERSION/*
-make -f unix/Makefile generic || exit 1
+make -f unix/Makefile generic LOCAL_UNZIP=-DIZ_HAVE_UXUIDGID $BZ2SUPPORT || exit 1
 cat unzip > $PKG/usr/bin/unzip
 cat unzipsfx > $PKG/usr/bin/unzipsfx
 cat funzip > $PKG/usr/bin/funzip

The above assumes that the bzip2 source package (bzip2-1.0.6.tar.gz) and process.c.diff.gz are present alongside infozip.SlackBuild.

Here are the uncompressed contents of process.c.diff.gz (basically the patch from the Debian bug report linked above):

Code:

--- ./process.c.orig    2009-03-06 02:25:10.000000000 +0100
+++ ./process.c 2013-09-12 10:51:16.000000000 +0200
@@ -2895,9 +2895,9 @@
        */
 
 #ifdef IZ_HAVE_UXUIDGID
-            if (eb_len >= EB_UX3_MINLEN
-                && z_uidgid != NULL
-                && (*((EB_HEADSIZE + 0) + ef_buf) == 1)
+            if ((eb_len >= EB_UX3_MINLEN)
+                && (z_uidgid != NULL)
+                && ((*((EB_HEADSIZE + 0) + ef_buf) == 1)))
                    /* only know about version 1 */
            {
                uch uid_size;
@@ -2909,10 +2909,10 @@
                flags &= ~0x0ff;      /* ignore any previous UNIX field */
 
                if ( read_ux3_value((EB_HEADSIZE + 2) + ef_buf,
-                                    uid_size, z_uidgid[0])
+                                    uid_size, &z_uidgid[0])
                    &&
                      read_ux3_value((EB_HEADSIZE + uid_size + 3) + ef_buf,
-                                    gid_size, z_uidgid[1]) )
+                                    gid_size, &z_uidgid[1]) )
                {
                    flags |= EB_UX2_VALID;  /* signal success */
                }


ruario 09-15-2013 04:41 AM

Thanks Patrick!

Quote:

Originally Posted by Changelog
a/infozip-6.0-i486-2.txz: Rebuilt.
Fixed bzip2 and UID/GID support in unzip.

P.S. Your method of adding bzip2 support is far neater than mine, unsurprisingly! :)


All times are GMT -5. The time now is 11:40 PM.