GNU bug report logs - #61300
wc -c doesn't advance stdin position when it's a regular file

Previous Next

Package: coreutils;

Reported by: Stephane Chazelas <stephane <at> chazelas.org>

Date: Sun, 5 Feb 2023 18:28:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Pádraig Brady <P <at> draigBrady.com>, Stephane Chazelas <stephane <at> chazelas.org>
Cc: 61300 <at> debbugs.gnu.org
Subject: bug#61300: wc -c doesn't advance stdin position when it's a regular file
Date: Mon, 6 Feb 2023 11:50:37 -0800
On 2/6/23 11:38, Pádraig Brady wrote:
> Note also if you really want to read, you can always `cat | wc -c`
> rather than just `wc -c`

Even that's not guaranteed, as 'cat' is not required to use the 'read' 
system call if it can determine that the standard input contains only 
NULs without calling 'read'. (GNU 'cat' doesn't do this, but POSIX 
allows it.)

We shouldn't complicate 'wc' (thus slowing it down and worse, possibly 
introducing a bug) if the only goal is to make 'wc' fail more often in 
implausible scenarios.




This bug report was last modified 2 years and 134 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.