Hi, Compiling with -O2 generate codes which mangles the return value from the yesno function, causing the overwrite prompt to ignore 'n'.
To reproduce: $ echo "original" >out $ gzip out $ echo "replaced" >out $ gzip out gzip: out.gz already exists; do you wish to overwrite (y or n)? n $ gzip -cd out.gz replaced This can be seen in Arch Linux and Fedora 18 x86_64 builds (and likely any other distribution using gcc-4.7) A very helpful person in the gcc bug tracker [1] pointed out it was probably yesno being declared with two different function declarations. And sure enough, the gnulib one declares with bool and gzip.h uses int as the return value. [1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56211 The following fixes this for me: 2013-02-05 Allan McRae <al...@archlinux.org> * gzip.h: Return bool from yesno to be consistent with gnulib. diff -Naur gzip-1.5-orig/gzip.h gzip-1.5/gzip.h --- gzip-1.5-orig/gzip.h 2012-01-01 18:53:58.000000000 +1000 +++ gzip-1.5/gzip.h 2013-02-05 22:08:44.498810902 +1000 @@ -42,6 +42,7 @@ #include <sys/types.h> /* for off_t */ #include <time.h> #include <string.h> +#include <stdbool.h> #define memzero(s, n) memset ((voidp)(s), 0, (n)) #ifndef RETSIGTYPE @@ -323,4 +324,4 @@ extern int inflate (void); /* in yesno.c */ -extern int yesno (void); +extern bool yesno (void);