[Toybox] [PATCH] Implement `file -`.
enh
enh at google.com
Thu May 3 20:12:19 PDT 2018
the FSF file(1) is inconsistent too, in a way that suggests it's being
clever:
~$ file /dev/zero
/dev/zero: character special (1/5)
~$ file - < /dev/zero
/dev/stdin: data
~$
On Thu, May 3, 2018, 18:36 Rob Landley <rob at landley.net> wrote:
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20180503/1f93f29a/attachment-0001.htm>
More information about the Toybox
mailing list