bug-coreutils@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: "Pádraig Brady" <P@draigBrady.com>,
	"Stephane Chazelas" <stephane@chazelas.org>
Cc: 61300@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	[thread overview]
Message-ID: <d4ee93fe-97f6-1257-dbd3-73c56627a4ce@cs.ucla.edu> (raw)
In-Reply-To: <f484b2a3-d3bd-bf1c-b48b-4a0ed20cbd80@draigBrady.com>

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.




      reply	other threads:[~2023-02-06 19:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-05 18:27 bug#61300: wc -c doesn't advance stdin position when it's a regular file Stephane Chazelas
2023-02-05 19:59 ` Pádraig Brady
2023-02-05 20:59   ` Paul Eggert
2023-02-06  6:27     ` Stephane Chazelas
2023-02-06 19:38       ` Pádraig Brady
2023-02-06 19:50         ` Paul Eggert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-coreutils

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d4ee93fe-97f6-1257-dbd3-73c56627a4ce@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=61300@debbugs.gnu.org \
    --cc=P@draigBrady.com \
    --cc=stephane@chazelas.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).