Hello all,
the manual page of GNU gzip says:
------------------------------
DIAGNOSTICS
Exit status is normally 0; if an error occurs, exit status is 1. If a warning occurs, exit status is 2.
------------------------------
This is not the case sind version >1.5 for the situation when the source file already ends with .gz
Test:
$ gzip 2018.gz
gzip: 2018.gz already has .gz suffix -- unchanged
$ echo $?
0
Following the patch for it:
diff --git a/gzip.c b/gzip.c
index e6a7761..bf3eb0a 100644
--- a/gzip.c
+++ b/gzip.c
@@ -1417,8 +1417,8 @@ local int make_ofname()
/* Avoid annoying messages with -r (see treat_dir()) */
if (verbose || (!recursive && !quiet)) {
/* Don't use WARN, as it affects exit status. */
- fprintf (stderr, "%s: %s already has %s suffix -- unchanged\n",
- program_name, ifname, suff);
+ WARN ((stderr, "%s: %s already has %s suffix -- unchanged\n",
+ program_name, ifname, suff));
}
return WARNING;
} else {
Test:
$ gzip 2018.gz
gzip: 2018.gz already has .gz suffix -- unchanged
$ echo $?
2
Best regards,
Manfred