[Toybox] [PATCH] Implement `file -`.
Rob Landley
rob at landley.net
Thu May 3 18:36:14 PDT 2018
On 05/03/2018 06:40 PM, enh wrote:
> + // If we're working on stdin, copy to a temporary file and then use
> + // an fd for that file. That way the rest of the code doesn't have to
> + // worry about non-seekable/non-mmap'able input.
Hmmm, in the old code:
$ ./file ../filesystems.tar.gz
../filesystems.tar.gz: gzip compressed data
$ ./file - < ../filesystems.tar.gz
-: gzip compressed data
$ file /dev/zero
/dev/zero: character special
$ file - < /dev/zero
/dev/stdin: data
That's inconsistent about /dev/zero, not sure why.
But if we copy /dev/zero to a temp file we'll fill the hard drive...
Rob
More information about the Toybox
mailing list