bug-coreutils
[Top][All Lists]
Advanced

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

Re: cp(1) fails to copy file from /proc


From: Jim Meyering
Subject: Re: cp(1) fails to copy file from /proc
Date: Sun, 19 Apr 2009 14:52:57 +0200

Andreas Schwab wrote:
> Jim Meyering <address@hidden> writes:
>
>> Sure, but that's not the question.
>> The question is whether we can assume short-read-on-regular-file
>> implies EOF.
>
> I think you can look at it as if you are reading a growing file.

Makes sense.
But if a regular file is growing, then it's stat.st_size changes.
For files in /proc, stat.st_size is always 0.

If it is implemented that way, then it would be better
to hide such counter-intuitive details from applications.

Already, the fact that st_size is 0 for a known- and usually
constant-sized, non-empty file is misleading -- probably contrary
to POSIX, too, given the definition of st_size for a regular file.

I wonder what would break if those types were changed from S_IFREG
to S_IFIFO.  One drawback might be that files in /proc are currently
seekable.  FIFO's aren't.

It's a good thing that so few of the files in /proc are large
enough to be affected.




reply via email to

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