]> git.cworth.org Git - gzip/commitdiff
Imported Debian patch 1.3.5-14
authorBdale Garbee <bdale@gag.com>
Tue, 20 Jun 2006 21:02:27 +0000 (15:02 -0600)
committerBdale Garbee <bdale@gag.com>
Fri, 6 Jun 2008 04:29:33 +0000 (22:29 -0600)
debian/changelog
debian/control
gzexe.in
gzip.c
zgrep.in

index 37b6bcd0ec08d56b40335784553312e82e44851c..459e80e5fc9c890cd8ba39c13e93e1bc0287329e 100644 (file)
@@ -1,3 +1,15 @@
+gzip (1.3.5-14) unstable; urgency=medium
+
+  * update section to match override
+  * patch from Matthew Chapman to avoid deleting input file before we're
+    sure the output file has been written without errors, closes: #366660
+  * patch from Reuben Thomas to fix zgrep return code, 
+    closes: #292896, #192891, #190442
+  * enable gzexe compressed files to work on systems where tempfile is not
+    available while retaining preference for tempfile, closes: #334540
+
+ -- Bdale Garbee <bdale@gag.com>  Tue, 20 Jun 2006 15:02:27 -0600
+
 gzip (1.3.5-13) unstable; urgency=low
 
   * patch from Reuben Thomas fixes problem passing zgrep filenames starting
index ff41a3482c305fc50a485b662a697b9de10ba0f2..74a4c222344154aa30901091b016f32cb8d709dc 100644 (file)
@@ -1,9 +1,9 @@
 Source: gzip
-Section: base
+Section: utils
 Priority: required
 Maintainer: Bdale Garbee <bdale@gag.com>
 Build-Depends: debhelper (>= 5), texinfo
-Standards-Version: 3.6.2.2
+Standards-Version: 3.7.2
 
 Package: gzip
 Architecture: any
index d1916356c9ae9ae3b258eea47ad9359269d362ae..bcd788c671450699d990ed548464ad5614ea22a6 100755 (executable)
--- a/gzexe.in
+++ b/gzexe.in
@@ -121,7 +121,7 @@ skip=23
 set -C
 umask=`umask`
 umask 77
-tmpfile=`tempfile -p gztmp -d /tmp` || exit 1
+tmpfile=`tempfile -p gztmp -d /tmp` || tmpfile=/tmp/gztmp.$$ || exit 1
 if tail +$skip "$0" | /bin/gzip -cd >> $tmpfile; then
   umask $umask
   /bin/chmod 700 $tmpfile
diff --git a/gzip.c b/gzip.c
index a72cb201b0a4831ce11827c2b35c04f5b2b8d21d..bfab6e74b96f0e0f7a55a558a8c247b9cd14f914 100644 (file)
--- a/gzip.c
+++ b/gzip.c
@@ -882,10 +882,21 @@ local void treat_file(iname)
 
     close(ifd);
     if (!to_stdout) {
-         /* Copy modes, times, ownership, and remove the input file */
+         /* Copy modes, times, and ownership */
          copy_stat(&istat);
          if (close(ofd))
             write_error();
+         remove_ofname = 0;
+
+         /* It's now safe to remove the input file: */
+         if (xunlink (ifname)) {
+           int e = errno;
+           WARN((stderr, "%s: ", progname));
+           if (!quiet) {
+             errno = e;
+             perror(ifname);
+           }
+         }
     }
     if (method == -1) {
        if (!to_stdout) xunlink (ofname);
@@ -1745,16 +1756,6 @@ local void copy_stat(ifstat)
 #ifndef NO_CHOWN
     fchown(ofd, ifstat->st_uid, ifstat->st_gid);  /* Copy ownership */
 #endif
-    remove_ofname = 0;
-    /* It's now safe to remove the input file: */
-    if (xunlink (ifname)) {
-       int e = errno;
-       WARN((stderr, "%s: ", progname));
-       if (!quiet) {
-           errno = e;
-           perror(ifname);
-       }
-    }
 }
 
 #if ! NO_DIR
index 9ddb55738e1150e0138015e988b57c6f02d63ec3..cac4863f4270881138aa3c2a599dd884246172ac 100755 (executable)
--- a/zgrep.in
+++ b/zgrep.in
@@ -107,7 +107,24 @@ for i do
       else
        sed_script="s|^|${i}:|"
       fi
-      $grep $opt "$pat" | sed "$sed_script"
+      # Hack adapted from GPLed code at
+      # http://home.comcast.net/~j.p.h/cus-faq-2
+      # Has the same effect as the following two lines of bash:
+      #
+      # $grep $opt "$pat" | sed "$sed_script"
+      # exit ${PIPESTATUS[0]}
+      #
+      # Inside the `...`, fd4 goes to the pipe whose other end is read
+      # and passed to eval; fd1 is the normal standard output
+      # preserved the line before with exec 3>&1
+      exec 3>&1
+      eval `
+      exec 4>&1 >&3 3>&-
+      {
+       $grep $opt "$pat" 4>&-; echo "r=$?;" >&4
+      } | sed "$sed_script"
+      `
+      exit $r
     fi
   r=$?
   test $res -lt $r && res=$r