Subject: bug#37336: Allow to decompress files without .gz suffix and add an option to specify output file name on decompression

From: Sergey Ponomarev <[email-masked]>
Date: Sun, 8 Sep 2019 00:11:40 +0300

Hello,

I have an SVG image file called image.svg. Then I gzipped and renamed it to
image.svgz.
The resulted *.svgz file is supported by almost all browsers as a usual
image.
But now I would like to extract the original file back:

$ gzip -d image.svgz
gzip: image.svgz: unknown suffix -- ignored

So gzip doesn't allow me to this just because the file have not a proper
.gz extension.
This makes sense because gzip can't determine the output file name. But
gzip by default stores an original file name (-N or -name option) so let's
add -N:

$ gzip -l -N idea.svgz
    compressed  uncompressed     ratio uncompressed_name
                 849                  2489  67.0% image.svg
$ gzip -d -N image.svgz
gzip: image.svgz: unknown suffix -- ignored

Again the same problem while I clearly specified to use an original file
name.
I confused and from my point of view this is a bug.

But if you try to decompress to stdout (i.e. use it with pipe and output to
a file) then all will be find.

The similar problem have another compressors like a new one ZStandard:
  https://github.com/facebook/zstd/issues/754

But in zstd there is an option to clearly specify the output file name:
-o file: result stored into `file` (only if 1 input file)

This also solves the problem but also makes it more convinced to call
pragmatically gzip without pipes (i.e. to call it from an archive manager
like GNOME File Roller)

So, could you consider to implement the feature or will you accept a patch
from me?

Regards,
Sergey Ponomarev