bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: diff: [ENHANCEMENT] add option to support compressed files: -z, --co


From: Bruno Haible
Subject: Re: diff: [ENHANCEMENT] add option to support compressed files: -z, --compress
Date: Tue, 18 Aug 2009 00:30:00 +0200
User-agent: KMail/1.9.9

Bob Proulx wrote:
> If it is in the shell and therefore supports all compressors and all
> command line utilities uniformly then I do not think that it should be
> added to the code of every command line program.

Regardless of whether the shell supports <(...) or not, it would be a
bad idea to add special compression/decompression options to many programs.

The basic principle of the Unix shell is that the user is given lots of
small programs, one for each purpose, and that they can be combined using
shell constructs (pipes, temporary files, file descriptors). Decompression
fits perfectly well in this model, since it takes a byte stream on input
and produces a byte stream on output.

The task of comparing compressed files can be performed with a script,
using the elementary programs
  - od, test    for analyzing the file type of the input files
  - mktemp      for creating the temporary files containing the decompressed
                data
  - diff        for comparing the decompressed data.
(You can even do without temporary files on systems that support the
/dev/fd/n = /proc/self/fd/n fake files.)

Only for programs whose arguments are very often compressed (like 'tar')
it was worth adding a '-z' option.

Note that there are two ways of making the decompression entirely
transparent, not requiring a command line option at all:
  - at the libc level, through zlibc.
  - at the kernel level, through a filesystem such as ZFS, Reiser4, or btrfs.

Bruno




reply via email to

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