[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#23073: wc reports wrong byte counts when using '--from-files0=-'
From: |
Pádraig Brady |
Subject: |
bug#23073: wc reports wrong byte counts when using '--from-files0=-' |
Date: |
Tue, 20 Dec 2016 13:12:02 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
On 20/12/16 01:50, Bernhard Voelker wrote:
> On 12/19/2016 08:00 PM, Pádraig Brady wrote:
>> + [bug introduced in coreutils-7.1]
>
> FWIW I think that the bug was not introduced in v7.0-96-gc2e56e0:
> I had a working 8.23 on a system here, so I took the time to search deeper.
> I found the reason to be the wrong value of the 'hi_pos' parameter passed
> to lseek():
>
> open("wc.big", O_RDONLY) = 3
> fstat(3, {st_mode=S_IFREG|0644, st_size=1073741824, ...}) = 0
> lseek(3, 1073741824, SEEK_CUR) = 1073741824
> read(3, "", 16384) = 0
> fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 8), ...}) = 0
> write(1, "1073741824 wc.big\n", 181073741824 wc.big) = 18
> close(3) = 0
> open("wc.small", O_RDONLY) = 3
> lseek(3, 1073741824, SEEK_CUR) = 1073741824
> read(3, "", 16384) = 0
> write(1, "1073741824 wc.small\n", 201073741824 wc.small
>
> This took me directly to v8.23-47-g2662702 (which a quick test
> against v8.23-47-g2662702^ confirmed).
>
> Therefore, I think it's worth to do the following amendment:
>
> - [bug introduced in coreutils-7.1]
> + [bug introduced in coreutils-8.24]
Right!
While st_size would have been incorrect for subsequent
files since v7.1, it was only used since v8.24.
Fixed with:
http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=94d2c68
thanks,
Pádraig