bug-gzip
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FreeBSD vs. Debian behavior discrepancy


From: Paul Eggert
Subject: Re: FreeBSD vs. Debian behavior discrepancy
Date: Wed, 02 Nov 2011 10:39:31 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0) Gecko/20110927 Thunderbird/7.0

I'm afraid that script is busted.  It should use xargs -r.
You can see the bug by running the script with stdout
not being a terminal -- the script will send garbage to stdout.

That being said, the FreeBSD behavior sounds a bit
more useful, so I installed the following patch, and
the new behavior should be in the next version of GNU gzip.

>From 749cadea46b273be2acb50189341df1cf6a51492 Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Wed, 2 Nov 2011 10:35:00 -0700
Subject: [PATCH] * gzip.c (treat_stdin): If quiet, be quiet with plain gzip -q.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Problem reported by Michaël Guitton in
<http://lists.gnu.org/archive/html/bug-gzip/2011-11/msg00000.html>.
---
 gzip.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/gzip.c b/gzip.c
index 6164438..cb10a23 100644
--- a/gzip.c
+++ b/gzip.c
@@ -617,11 +617,15 @@ local void treat_stdin()
          *
          * Here we use the --force option to get the other behavior.
          */
-        fprintf(stderr,
-    "%s: compressed data not %s a terminal. Use -f to force %scompression.\n",
-                program_name, decompress ? "read from" : "written to",
-                decompress ? "de" : "");
-        fprintf (stderr, "For help, type: %s -h\n", program_name);
+       if (! quiet)
+         fprintf (stderr,
+                  ("%s: compressed data not %s a terminal."
+                   " Use -f to force %scompression.\n"
+                   "For help, type: %s -h\n"),
+                  program_name,
+                  decompress ? "read from" : "written to",
+                  decompress ? "de" : "",
+                  program_name);
         do_exit(ERROR);
     }
 
-- 
1.7.6.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]