Hello there,

>From gzip(1):


DESCRIPTION
  ......
  ...
  If compression would not reduce the size of a file, the file is ignored
  (unless -f is used).


EXIT STATUS
  .......
  ....
  2       At least one of the specified files was not compressed
          since -f was not specified and compression would have
          resulted in a size increase.






On a default 5.6 release machine, the man page behaviour is seen:

$ uname -mrsv
OpenBSD 5.6 GENERIC#274 i386
$ cd $(mktemp -d)
$ cp /bsd .
$ while stat -f "%Dz" bsd
> do
> gzip bsd || { print "exit code: $?"; break; };
> mv bsd.gz bsd
> done
10659734
4822361
4819987
exit code: 2
$



On a default 6.0 release machine, gzip keeps on going/growing:

$ uname -mrsv
OpenBSD 6.0 GENERIC#1917 i386
$ cd $(mktemp -d)
$ cp /bsd .
$ while stat -f "%Dz" bsd
> do
> gzip bsd || { print "exit code: $?"; break; };
> mv bsd.gz bsd
> done
10877658
4903863
4901041
4902548
4904065
4905582
4907089
4908606
4910109
4911631
4913153
^C

The 3rd compression at 4902548 bytes is bigger, and so are the rest.

On the 5.6 machine, gzip exits 2 when attempting the 3rd round.


Bug?
-- 
Craig Skinner | http://linkd.in/yGqkv7

Reply via email to