bug#19969: problem: wc -c doesn't read actual # of bytes in file
From:
Linda Walsh
Subject:
bug#19969: problem: wc -c doesn't read actual # of bytes in file
Date:
Sun, 01 Mar 2015 13:33:51 -0800
User-agent:
Thunderbird
Bernhard Voelker wrote:
On 02/28/2015 09:59 AM, Linda Walsh wrote:
(coreutils-8.21-7.7.7)
wc -c(bytes) doesn't seem to reliably read the number
of bytes in a file.
I was wanting to find out what the largest data-source
files in '/proc' and '/sys' (didn't get around to trying
/sys, since all the files under /proc/sys return 0 bytes.
Note -- "wc -l" doesn't return '0' on the /proc/sys files.
As root:
# cd /proc
Thanks for the report.
However, I'm not 100% sure what the problem is - as you didn't narrow
the case down to a certain file, nor did you show us the output and
what you expected.
---
Yes. I did. Anything under /proc/sys is affected.
There is more than 1 'certain file' that is affected.
What I would _expect_ is for it to show the actual # of bytes
in the file rather than a size of 0.
That's why I included the command to duplicate the problem.
Are you saying you tried it and it doesn't do the same thing on
your system?
Without me debugging the source, how much more do you
want me to narrow it down? If you change the "wc -c" => "wc "-l",
you will see non-zero numbers for files under /sys/proc.
BTW .. it seems many files under /sys are also affected.
----
As for files under /proc, the 'net' directory seems to work:
Are you wanting a list like this:
---
It may work *around* the problem, but doesn't explain
the inconsistencies between, for example, /proc/sys and /proc/net.
If the patch forces a read, there's a good chance it will work, but
the inconsistent returns from /proc/sys, /proc/net AND /sys(seems
to often show 4K as noted in the other bug report), would seem
to indicted a kernel bug somewhere. If they were ALL 0 or all 4K,
then I'd say the kernel doesn't return size for either of those
interfaces (and that may be as far as that goes and the workaround
is the only solution), but that the kernel interfaces are giving
back inconsistent answers seems like different users not using
the same kernel interfaces to return the 'inode' size.
Did this provide enough info?
Am a bit leery of trying a new version of core utils on
short notice as I need to make sure new breakages having occurred in
other utils and w/my luck, I might accidently install the newer
version over a working version (Murphy** visits, here, often).
**-as in Murphy's Law..
Cheers!
Linda