[Top][All Lists]

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

Re: Bug in od with "-j" option?

From: Jim Meyering
Subject: Re: Bug in od with "-j" option?
Date: Wed, 15 Aug 2007 12:03:29 +0200

Paul Eggert <address@hidden> wrote:

> Jim Meyering <address@hidden> writes:
>> +         If the number of bytes left to skip is larger than
>> +         the size of the current file, we can decrement
>> +         n_skip and go on to the next file.  */
>>        if (S_ISREG (file_stats.st_mode) && 0 <= file_stats.st_size)
> An idle thought.  Given the problems we've had elsewhere with /proc
> files that claim to be regular files of size zero, perhaps the above
> line should be changed to the following?
>         if (S_ISREG (file_stats.st_mode) && 0 < file_stats.st_size)
> More generally, the idea is that if a file claims to be a regular file
> of size zero, then GNU utilities should not attempt to do
> optimizations based on the assumption that the file is empty, but
> should go ahead and try to actually read the file.  It's kind of a
> pain to treat size-zero files specially, but there it is.

Good catch.
Yes, it is good to work around kernel lies,
at least when it's recent Linux :-)
I'll check that in this evening, along with a test.

reply via email to

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