bug-coreutils
[Top][All Lists]
Advanced

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

bug#23073: wc reports wrong byte counts when using '--from-files0=-'


From: William R. Fraser
Subject: bug#23073: wc reports wrong byte counts when using '--from-files0=-'
Date: Sun, 20 Mar 2016 17:59:57 -0700 (PDT)
User-agent: Alpine 2.20 (LNX 67 2015-01-07)

When wc gets its list of files by reading from stdin, using the argument '--from-files0=-', it reuses the same fstatus struct for each file.

The problem is that the 'wc' function checks the 'failed' member of this struct and if it is <=0, it skips doing fstat on the file. The main loop doesn't reset this value between files, so only the first file has fstat done on it.

This can result in the 'wc' function seeking past the end of subsequent files and then over-reporting their byte counts.

See the attached patch, which resets the fstatus struct in between files when reading the file list from stdin.

Thanks,
- Bill Fraser

Attachment: 0001-wc-fix-wrong-byte-counts-when-using-files-from0.patch
Description: 0001-wc-fix-wrong-byte-counts-when-using-files-from0.patch


reply via email to

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