Subject: Re: bug#8154: du: issue with `--files0-from=DIR'

From: Eric Blake <[email-masked]>
Date: Wed, 02 Mar 2011 07:46:21 -0700

[adding bug-gnulib]

On 03/02/2011 06:28 AM, Stefan Vargyas wrote:
> Dear maintainers,
> 
> While building and running coreutils v8.9, I came across the following issue of 'du':
> 
>   $ mkdir /tmp/foo
>   $ du --files0-from=/tmp/foo
>   du: `/tmp/foo': read error: Is a directory
>   ...
> 
> The program enters an infinite loop

Thanks for the report.  This is indeed a bug.

I wonder if the better fix would be to modify the gnulib argv-iter
module to make argv_iter_init_stream to fail if fileno(fp) is a
directory, since not all platforms reliably fail with EISDIR when doing
read() on a directory (some, like BSD, successfully return EOF, and some
older systems even read raw directory contents).

-- 
Eric Blake   [email-masked]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org