GNU bug report logs - #47243
pr lacks -p

Previous Next

Package: coreutils;

Reported by: Eric Blake <eblake <at> redhat.com>

Date: Thu, 18 Mar 2021 15:39:01 UTC

Severity: wishlist

Full log


Message #46 received at 47243 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Collin Funk <collin.funk1 <at> gmail.com>
Cc: 47243 <at> debbugs.gnu.org, Pádraig Brady <P <at> draigBrady.com>
Subject: Re: bug#47243: pr lacks -p
Date: Mon, 28 Jul 2025 08:14:22 -0700
On 2025-07-27 19:21, Collin Funk wrote:

> I think that v3 attached should cover everything.

In addition to Pádraig's comments, I would add:

> +  a newline character is read from /dev/tty, as required by POSIX Issue
> +  6.  The corresponding long option is --pause.

Don't say "Issue 6" as almost nobody knows what that means and it's 
obsolete anyway. Just say "POSIX".

> +              if (ch == EOF)
> +                {
> +                  /* Just exit if the user presses Ctrl-D.  */
> +                  if (feof (tty_fp))
> +                    goto finish;
> +                  error (EXIT_FAILURE, errno, _("error reading %s"),
> +                         quoteaf ("/dev/tty"));
> +                }

'goto finish;' should be 'return;'. That way, we don't need the 'finish' 
label.

It's possible for feof and ferror to both be true. In that case, pr 
should report the error. So, this code should call ferror instead of 
calling feof.

Come to think of it, why use stdio here? Plain 'open' and 'read' work 
just as well for this, and avoid possible stdio glitches. There's no 
real need for stdio's buffering.






This bug report was last modified 49 days ago.

Previous Next


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