Received: (at 47243) by debbugs.gnu.org; 30 Jul 2025 11:18:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 30 07:18:31 2025
Received: from localhost ([127.0.0.1]:39868 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1uh4pK-0006hO-AZ
for submit <at> debbugs.gnu.org; Wed, 30 Jul 2025 07:18:31 -0400
Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:60703)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <pixelbeat@HIDDEN>)
id 1uh4pG-0006gj-7A
for 47243 <at> debbugs.gnu.org; Wed, 30 Jul 2025 07:18:27 -0400
Received: by mail-wm1-x32c.google.com with SMTP id
5b1f17b1804b1-45896cf24ebso4304035e9.1
for <47243 <at> debbugs.gnu.org>; Wed, 30 Jul 2025 04:18:26 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1753874298; x=1754479098; darn=debbugs.gnu.org;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:sender:from:to:cc:subject:date:message-id:reply-to;
bh=nN4dSI8Mn2miU/0ZhFwruTQpC6H4U5AIQx2vOG0eqsk=;
b=OSDnQ/PtZnEphl28qngiOJqMbosffoIYaZtcJjIow/V3tsEkdX7cAiBZdvKJFTgyox
FB8YTTsWbfj6WVmPGz74fXle4Z4E0peEGfOsEnqgIRWYuxIl6JR3MDRm5IcipbhLrBfC
8FHMJqBRbQd7FtTsrTWBmNmfQ1a/I2mD+npDJwzLJniPtHOZuAfcGKq+o5mbqo8SqXrD
G+UMR11i9n719TLCyQm27NPwtkWirpQ60S5Gg+4wyR0EPTGsK4RvasWNDb4+SXspWIRM
15vc9+gZoNmoYBMDKsmDEFalPmusd0Bx4cdOUi4966lCdUBL6+Wf09Mb0pJA594h0zhe
1VoQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1753874298; x=1754479098;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:cc:to:subject:user-agent:mime-version:date:message-id
:sender:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=nN4dSI8Mn2miU/0ZhFwruTQpC6H4U5AIQx2vOG0eqsk=;
b=rL/JoCL113EG4XWJRE/M6jvoCw4g9jCAB7A0+WKvjaljhqt8vpEslVo/SqtPkJSLhy
ce0XhawDlUZrroiMxX+gT+h4dnB7rKUEwQv1DJfI6PfhcB04g9CMdccQXlYReKNToHEo
JsVWXDEnX0qcGUxMnBuU0SxrYranqGv+kY0V5UI7SjoQvn7279Dfe3q4Uj8+eJv8sfra
UMwc0XWyyf1spINUN8k6zTi/NSWCKD2JNRLWmVoRBtAwvsmNTP2agRY+gfAecZmtkEQt
9qNyQhnEMmaaasjHWNxxf9snCuAEUqnZAG/xhNLJqeyAxMtHYKx7maLavS1U0fLmEJG6
wu3g==
X-Gm-Message-State: AOJu0Yz6ccEPnJYLVgtsixnBOpVrA9d+pwFOwueDd6tHtkkuLxNlI2Si
K2l/YlwdcOeJZ8nT9voGSf3dGsMeAnzuixBdOorZm5FeTRxk/Ujtlx/ZPU15fw==
X-Gm-Gg: ASbGncv1Mo65+J3895QIIqAGa26uxUblmnHEe76IlUo1/jBMHcrnA/TFZ2Dyj+5xVL9
7FdjSdoxFnVMT/V7JPaimt59/ZQG9M3kNwUpfjD4ywnaAqriwq8TNs6Nd/0ewO/G8gsZOtZu7Lj
kRgTcdpB/B/1XIouytRsBs12AdJiHmMtCSe+cAGubkdiGwmvB/S9QKK6WzcoIOHgVAqgp971h0q
kJsppySN8OJD9B1O1xDiEOLxyTRqYlgA6dmXMHe5bF56F9MgQ4cSYu6XvSik12ZIGu/rzdClQnp
oitXA7Ua4EVWNeTftKhEXu6/TBr5yXpSakBdrORh5H/0KjZxcnWCDgdFVocDsJ0tko23HOBMD5Z
jBDRb1alL80C21JNYmdXFE4RTYHhAL6RNuTd+OT5MjraJlGk+JqBrOFg6YkOCTZiqQe+eKKnFnx
Fgrg==
X-Google-Smtp-Source: AGHT+IHoZqzIqvNT9M+XJjuDOB/xoNImQeVDN1iYkJqZGqN74UKKndxtjNRGjlm3IBn18bhXw810Bw==
X-Received: by 2002:a05:600c:3512:b0:456:302:6dc3 with SMTP id
5b1f17b1804b1-45892bcfbf0mr24669485e9.26.1753874297657;
Wed, 30 Jul 2025 04:18:17 -0700 (PDT)
Received: from [192.168.1.31]
(86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146])
by smtp.googlemail.com with ESMTPSA id
ffacd0b85a97d-3b78d45d152sm6772529f8f.3.2025.07.30.04.18.16
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Wed, 30 Jul 2025 04:18:17 -0700 (PDT)
Message-ID: <e2f30ccb-5fd6-419a-b1d8-9173c78b0c24@HIDDEN>
Date: Wed, 30 Jul 2025 12:18:16 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird Beta
Subject: Re: bug#47243: pr lacks -p
To: Collin Funk <collin.funk1@HIDDEN>
References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN>
<87y0s98dmn.fsf@HIDDEN>
<3f06b63f-e96b-4b31-bbf6-7edf446b69ae@HIDDEN>
<8734ah8atg.fsf@HIDDEN> <87tt2x6w59.fsf@HIDDEN>
<da614b77-81b5-449c-97b2-2e6291bff085@HIDDEN> <878qk9kqck.fsf@HIDDEN>
<0fcb335b-cfa1-4ad7-8db2-fafcff18eed3@HIDDEN>
<8fa2295e-39dd-459b-9b1b-fc00573719cc@HIDDEN>
<87pldkqku5.fsf@HIDDEN> <51a2c808-61b7-4f4f-9407-9e7e342366ea@HIDDEN>
<8734af1uh7.fsf@HIDDEN> <cbb07dd8-cd64-465d-9af9-2bd954621c10@HIDDEN>
<87v7na703r.fsf@HIDDEN>
Content-Language: en-US
From: =?UTF-8?Q?P=C3=A1draig_Brady?= <P@HIDDEN>
In-Reply-To: <87v7na703r.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 47243
Cc: 47243 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
On 30/07/2025 05:51, Collin Funk wrote:
> Paul Eggert <eggert@HIDDEN> writes:
>
>>> +After printing each page, print an alert (bell) to standard error and
>>> +wait for a newline to be read from @file{/dev/tty} before printing the
>>> +next page.
>>
>> This sentence should start "Before" not "After", with the rest of the
>> sentence changed accordingly. There is no bell printed after the last
>> page.
>>
>> Looking at the code, it seems that this mistake has leaked into the
>> code as well, in that sometimes 'pr' will print an alert and wait for
>> '\n' at end of file, when there is no page to print. If I'm right,
>> that needs to be fixed; pr should wait for '\n' only if it will
>> actually print something afterward.
>
> Fixing this required a bit more understanding of the code on my part,
> but I think the attached patch should address it.
>
> The existing code uses a 'pad_vertically' variable to keep track of
> whether the current page has text or a header that needs to be
> printed. Therefore, any time we set it to true, we must also pause. But
> only once, at the start of the page.
Looking good. A few tweaks...
The NEWS for -p should be in a "New Features" section.
The texinfo for --pause should:
s/before printing the next page/before printing the page/
I'd have a slight preference for _not_ gating the isatty(STDOUT) check on $POSIXLY_CORRECT.
We generally only use $POSIXLY_CORRECT to gate incompatible behavior.
The write_error() after the putc('\a') should be a plain error (EXIT_FAILURE, ...)
thanks,
Padraig
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.
Received: (at 47243) by debbugs.gnu.org; 30 Jul 2025 04:51:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 30 00:51:17 2025
Received: from localhost ([127.0.0.1]:38197 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1ugyma-0002NX-Tu
for submit <at> debbugs.gnu.org; Wed, 30 Jul 2025 00:51:17 -0400
Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:52665)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <collin.funk1@HIDDEN>)
id 1ugymX-0002Mu-65
for 47243 <at> debbugs.gnu.org; Wed, 30 Jul 2025 00:51:15 -0400
Received: by mail-pf1-x429.google.com with SMTP id
d2e1a72fcca58-74b54cead6cso4247129b3a.1
for <47243 <at> debbugs.gnu.org>; Tue, 29 Jul 2025 21:51:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1753851067; x=1754455867; darn=debbugs.gnu.org;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=1LEqQhY1f1iW4EXPN8u4vZlsYTb11ZDdY1mFVse7Xgk=;
b=UblfElCBE3AMmbRVzyR1CLywFXj5SktvzmmJHvYXzs6u1zJtpogYaVL1OUC7bsX3Br
kFQh4eYNhTHbu7bXf7fj6NjmwRN+oI/SkEixARkghs5/sAZFGsFgRcqyUBccJgxhvFL4
aIYbe6DaAbRatqFqcEG9I79xOgY4+egMCSAXjw/Jiw3dyOQTh+ZQcXz2nqQR+rmjbnxs
y26oP1258UhWbBYhUbVZ3wOxSYrEZGCc9yqAAX+NtS63nxhOEGqx3hd4k/l98SyTlkcD
CWnLT8EDV6o0oGOXhmwS68Zj+9Yxs/ooxZDeF8H8ebbi/GfMryiv5Il84pTTXF5QvWOk
jSbg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1753851067; x=1754455867;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=1LEqQhY1f1iW4EXPN8u4vZlsYTb11ZDdY1mFVse7Xgk=;
b=TNX2B+Pe0GrxvmwEr/jpPxIpI1kWL84D7uj3Gkw45Q+jX/QYi/zg/j0rTxLt20zbF+
8PpYQzeVUN0cd00d0smdvuXp0TtqZsTYadAXAl4xvwkdsYvBuS2bBW0YzVJEXenQ3+1U
wuOJr9Dtr8XPQ1dff7SQuMYkWN5AlEgHAn0CxkVG6yPVFKuo2vyPRklyAJZ97EdAgr94
03/pdgboR4jyXj5ngJbsUY7+eV7h+CCPq6xbOreAoClMX+QdMOm9/U4DVqWysD1fbEsq
Oz1SatvUumDr3wYH0XyG86wExuF0A3hTwqbrwDwT47SlVsS4XN4C8vkBEsahV1l7FT9X
H6Yg==
X-Gm-Message-State: AOJu0YwdMCuuM8BPf0+Q7eW57xvoQcG1DC7D2MmcOmZ1LUgovzN0gWfS
Api8Jvd8Z8qMFpohZ9SrjrUeeHDtLIPsysfwYtWfR+1ofLGkVHBOI4zk
X-Gm-Gg: ASbGnctWpZbNXwfX5NWuZugdYtA8antrd2zV4qLb2Lxkz4njFrR0y+x2NjUXRMhNWBD
JOzAByO+4goAPtzEPbeqL0b6GIs6jdjHBoTEPUsAkExlAcBtx7yonNMin0PpMasuncmsS1QV/zs
lEBVhG5t8m4Yem1S3/IYum+ss6JWUEIWjil2l1XwbYEuTMhMUmxgpZAC5LfHJ3fYo5YRzUrTqzB
hsOeWR1z1/+N8qQ3uF/rEN+voyGCnahoEK4GHkkwdolzlq9Nm10HvVoW/lGQvTw+nwv0AtRo5ap
k1l5phACXnnqzVeG+HKSHeSrJx61e+WKC45cV3N9jg4UxKTlWLmOcg/w5w9rUJrIbvr5Odz2D38
O2xFLLbYzqCzQbw==
X-Google-Smtp-Source: AGHT+IEoo3SVhc3oW9FjeBCWXTEXX4wiuHJ1eoH57uIkSUhrHQhKVJwZ0UyXfrmQhbhjN0As5GGfnA==
X-Received: by 2002:a05:6a00:4b4c:b0:749:456:4082 with SMTP id
d2e1a72fcca58-76ab082d0acmr2758882b3a.1.1753851066630;
Tue, 29 Jul 2025 21:51:06 -0700 (PDT)
Received: from fedora ([2601:646:8081:3770::c971])
by smtp.gmail.com with ESMTPSA id
d2e1a72fcca58-7640863513bsm9545042b3a.8.2025.07.29.21.51.05
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 29 Jul 2025 21:51:05 -0700 (PDT)
From: Collin Funk <collin.funk1@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
Subject: Re: bug#47243: pr lacks -p
In-Reply-To: <cbb07dd8-cd64-465d-9af9-2bd954621c10@HIDDEN>
References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN>
<87y0s98dmn.fsf@HIDDEN>
<3f06b63f-e96b-4b31-bbf6-7edf446b69ae@HIDDEN>
<8734ah8atg.fsf@HIDDEN> <87tt2x6w59.fsf@HIDDEN>
<da614b77-81b5-449c-97b2-2e6291bff085@HIDDEN>
<878qk9kqck.fsf@HIDDEN>
<0fcb335b-cfa1-4ad7-8db2-fafcff18eed3@HIDDEN>
<8fa2295e-39dd-459b-9b1b-fc00573719cc@HIDDEN>
<87pldkqku5.fsf@HIDDEN>
<51a2c808-61b7-4f4f-9407-9e7e342366ea@HIDDEN>
<8734af1uh7.fsf@HIDDEN>
<cbb07dd8-cd64-465d-9af9-2bd954621c10@HIDDEN>
Date: Tue, 29 Jul 2025 21:51:04 -0700
Message-ID: <87v7na703r.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 47243
Cc: 47243 <at> debbugs.gnu.org, =?utf-8?Q?P=C3=A1draig?= Brady <P@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)
--=-=-=
Content-Type: text/plain
Paul Eggert <eggert@HIDDEN> writes:
>> +After printing each page, print an alert (bell) to standard error and
>> +wait for a newline to be read from @file{/dev/tty} before printing the
>> +next page.
>
> This sentence should start "Before" not "After", with the rest of the
> sentence changed accordingly. There is no bell printed after the last
> page.
>
> Looking at the code, it seems that this mistake has leaked into the
> code as well, in that sometimes 'pr' will print an alert and wait for
> '\n' at end of file, when there is no page to print. If I'm right,
> that needs to be fixed; pr should wait for '\n' only if it will
> actually print something afterward.
Fixing this required a bit more understanding of the code on my part,
but I think the attached patch should address it.
The existing code uses a 'pad_vertically' variable to keep track of
whether the current page has text or a header that needs to be
printed. Therefore, any time we set it to true, we must also pause. But
only once, at the start of the page.
Collin
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
filename=v5-0001-pr-implement-p-and-modify-f-conforming-to-POSIX.patch
From 8afb79bbf294687fd4bdd3c92d1599f5021f703a Mon Sep 17 00:00:00 2001
Message-ID: <8afb79bbf294687fd4bdd3c92d1599f5021f703a.1753850358.git.collin.funk1@HIDDEN>
From: Collin Funk <collin.funk1@HIDDEN>
Date: Sun, 27 Jul 2025 15:00:15 -0700
Subject: [PATCH v5] pr: implement '-p' and modify '-f' conforming to POSIX
* src/pr.c (last_paused_page_number, pause_option, pause_on_first_page)
(tty_fd): New variables.
(short_options): Add '-p'.
(long_options): Add '--pause'.
(main): Add the option. Open a file descriptor to /dev/tty. Disable
pausing if POSIXLY_CORRECT is set.
(pause_maybe): New function.
(read_line, print_stored): Call it whenever pad_vertically is set to
true.
(usage): Mention the new option.
* doc/coreutils.texi (pr invocation): Document the new option. Document
the behaviors of POSIXLY_CORRECT on -p and -f.
* NEWS: Mention the new option. Mention the new behavior of 'pr -f' with
the POSIXLY_CORRECT environment variable set.
---
NEWS | 7 ++++
doc/coreutils.texi | 17 ++++++++++
src/pr.c | 80 ++++++++++++++++++++++++++++++++++++++++++++--
3 files changed, 101 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index 0b2be7116..3034ce718 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,9 @@ GNU coreutils NEWS -*- outline -*-
'factor' is now much faster at identifying large prime numbers,
and significantly faster on composite numbers greater than 2^128.
+ 'pr -f' with the POSIXLY_CORRECT environment variable set will pause
+ until a newline is read from /dev/tty before printing the first page.
+
** Bug fixes
cksum was not compilable by Apple LLVM 10.0.0 x86-64, which
@@ -64,6 +67,10 @@ GNU coreutils NEWS -*- outline -*-
Iranian locale (fa_IR) and for the Ethiopian locale (am_ET), and also
does so more consistently for the Thailand locale (th_TH.UTF-8).
+ pr now supports the -p option, to pause before printing each page
+ until a newline character is read from /dev/tty, as required by POSIX.
+ The corresponding long option is --pause.
+
* Noteworthy changes in release 9.7 (2025-04-09) [stable]
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 40ecf3126..5df11f910 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -2726,6 +2726,11 @@ @node pr invocation
Use a form feed instead of newlines to separate output pages. This does
not alter the default page length of 66 lines.
+@vindex POSIXLY_CORRECT
+This option will also pause until a newline is read from @file{/dev/tty}
+before printing the first page if the @env{POSIXLY_CORRECT} environment
+variable is set and standard output is associated with a terminal.
+
@item -h @var{header}
@itemx --header=@var{header}
@opindex -h
@@ -2825,6 +2830,18 @@ @node pr invocation
set with the @option{-W/-w} option. A limited overflow may occur with
numbered single column output (compare @option{-n} option).
+@item -p
+@itemx --pause
+@opindex -p
+@opindex --pause
+Before printing each page, print an alert (bell) to standard error and
+wait for a newline to be read from @file{/dev/tty} before printing the
+next page.
+
+@vindex POSIXLY_CORRECT
+This option is ignored if the @env{POSIXLY_CORRECT} environment variable
+is set and standard output is not associated with a terminal.
+
@item -r
@itemx --no-file-warnings
@opindex -r
diff --git a/src/pr.c b/src/pr.c
index e7081a059..5d945910c 100644
--- a/src/pr.c
+++ b/src/pr.c
@@ -419,6 +419,7 @@ typedef struct COLUMN COLUMN;
static int char_to_clump (char c);
static bool read_line (COLUMN *p);
+static void pause_maybe (void);
static bool print_page (void);
static bool print_stored (COLUMN *p);
static bool open_file (char *name, COLUMN *p);
@@ -618,6 +619,9 @@ static int files_ready_to_read = 0;
/* Current page number. Displayed in header. */
static uintmax_t page_number;
+/* The last page number that we paused on. */
+static uintmax_t last_paused_page_number;
+
/* Current line number. Displayed when -n flag is specified.
When printing files in parallel (-m flag), line numbering is as follows:
@@ -711,6 +715,15 @@ static char *custom_header;
/* (-D) Date format for the header. */
static char const *date_format;
+/* If true, pause before each page until a newline is read from /dev/tty. */
+static bool pause_option;
+
+/* If true, pause before the first page. */
+static bool pause_on_first_page;
+
+/* Used to read from /dev/tty if --p/--pause is in use. */
+static int tty_fd;
+
/* The local time zone rules, as per the TZ environment variable. */
static timezone_t localtz;
@@ -738,7 +751,7 @@ enum
};
static char const short_options[] =
- "-0123456789D:FJN:S::TW:abcde::fh:i::l:mn::o:rs::tvw:";
+ "-0123456789D:FJN:S::TW:abcde::fh:i::l:mn::po:rs::tvw:";
static struct option const long_options[] =
{
@@ -758,6 +771,7 @@ static struct option const long_options[] =
{"number-lines", optional_argument, nullptr, 'n'},
{"first-line-number", required_argument, nullptr, 'N'},
{"indent", required_argument, nullptr, 'o'},
+ {"pause", no_argument, nullptr, 'p'},
{"no-file-warnings", no_argument, nullptr, 'r'},
{"separator", optional_argument, nullptr, 's'},
{"sep-string", optional_argument, nullptr, 'S'},
@@ -868,6 +882,8 @@ main (int argc, char **argv)
idx_t n_digits = 0;
idx_t n_alloc = 0;
+ bool posixly_correct = (getenv ("POSIXLY_CORRECT") != nullptr);
+
initialize_main (&argc, &argv);
set_program_name (argv[0]);
setlocale (LC_ALL, "");
@@ -958,6 +974,8 @@ main (int argc, char **argv)
untabify_input = true;
break;
case 'f':
+ pause_on_first_page = posixly_correct;
+ FALLTHROUGH;
case 'F':
use_form_feed = true;
break;
@@ -999,6 +1017,9 @@ main (int argc, char **argv)
chars_per_margin = getoptnum (optarg, 0,
_("'-o MARGIN' invalid line offset"));
break;
+ case 'p':
+ pause_option = true;
+ break;
case 'r':
ignore_failed_opens = true;
break;
@@ -1061,7 +1082,7 @@ main (int argc, char **argv)
}
if (! date_format)
- date_format = (getenv ("POSIXLY_CORRECT") && !hard_locale (LC_TIME)
+ date_format = (posixly_correct && !hard_locale (LC_TIME)
? "%b %e %H:%M %Y"
: "%Y-%m-%d %H:%M");
@@ -1079,6 +1100,22 @@ main (int argc, char **argv)
error (EXIT_FAILURE, 0,
_("cannot specify both printing across and printing in parallel"));
+ /* POSIX states that the pausing behavior of -f and -p should occur only if
+ standard output is associated with a terminal. Only behave this way is
+ POSIXLY_CORRECT is set since the GNU Coding Standards discourages changing
+ program behavior based on output device type. */
+ if ((pause_option || pause_on_first_page) && posixly_correct
+ && ! isatty (STDOUT_FILENO))
+ pause_option = pause_on_first_page = false;
+
+ if (pause_option || pause_on_first_page)
+ {
+ tty_fd = open ("/dev/tty", O_RDONLY);
+ if (tty_fd < 0)
+ error (EXIT_FAILURE, errno, _("cannot open %s for reading"),
+ quoteaf ("/dev/tty"));
+ }
+
/* Translate some old short options to new/long options.
To meet downward compatibility with other UNIX pr utilities
and some POSIX specifications. */
@@ -1640,6 +1677,36 @@ print_files (int number_of_files, char **av)
;
}
+/* Pause until reading a newline from /dev/tty if needed. This function should
+ not be called until we know that we have text or a header to print for a
+ page. This means it must be called when pad_vertically is set to true. */
+
+static void
+pause_maybe (void)
+{
+ if ((pause_option || (pause_on_first_page && page_number == 1))
+ && last_paused_page_number < page_number)
+ {
+ last_paused_page_number = page_number;
+ if (pause_option
+ && (fputc ('\a', stderr) == EOF || fflush (stderr) != 0))
+ write_error ();
+ while (true)
+ {
+ char ch;
+ ssize_t bytes_read = read (tty_fd, &ch, sizeof ch);
+ if (bytes_read < 0)
+ error (EXIT_FAILURE, errno, _("error reading %s"),
+ quoteaf ("/dev/tty"));
+ /* Just exit if the user presses Ctrl-D. */
+ if (bytes_read == 0)
+ return;
+ if (ch == '\n')
+ break;
+ }
+ }
+}
+
/* Initialize header information.
If DESC is non-negative, it is a file descriptor open to
FILENAME for reading. */
@@ -2452,6 +2519,7 @@ read_line (COLUMN *p)
if (print_a_header && !storing_columns)
{
pad_vertically = true;
+ pause_maybe ();
print_header ();
}
else if (keep_FF)
@@ -2476,6 +2544,7 @@ read_line (COLUMN *p)
if (p->char_func != store_char)
{
pad_vertically = true;
+ pause_maybe ();
if (print_a_header && !storing_columns)
print_header ();
@@ -2586,7 +2655,10 @@ print_stored (COLUMN *p)
pad_vertically = true;
if (print_a_header)
- print_header ();
+ {
+ pause_maybe ();
+ print_header ();
+ }
if (p->status == FF_FOUND)
{
@@ -2824,6 +2896,8 @@ Paginate or columnate FILE(s) for printing.\n\
-o, --indent=MARGIN\n\
offset each line with MARGIN (zero) spaces, do not\n\
affect -w or -W, MARGIN will be added to PAGE_WIDTH\n\
+ -p, --pause pause at the beginning of each page until a newline\n\
+ is read from /dev/tty.\n\
-r, --no-file-warnings\n\
omit warning when a file cannot be opened\n\
"), stdout);
--
2.50.1
--=-=-=--
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.
Received: (at 47243) by debbugs.gnu.org; 29 Jul 2025 19:10:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 29 15:10:38 2025
Received: from localhost ([127.0.0.1]:36102 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1ugpif-0006mW-Q4
for submit <at> debbugs.gnu.org; Tue, 29 Jul 2025 15:10:38 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66]:52756)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eggert@HIDDEN>)
id 1ugpic-0006mB-9t
for 47243 <at> debbugs.gnu.org; Tue, 29 Jul 2025 15:10:35 -0400
Received: from localhost (localhost [127.0.0.1])
by mail.cs.ucla.edu (Postfix) with ESMTP id 914EE3C010841;
Tue, 29 Jul 2025 12:10:27 -0700 (PDT)
Received: from mail.cs.ucla.edu ([127.0.0.1])
by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP
id N4uVf_o63YdS; Tue, 29 Jul 2025 12:10:27 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
by mail.cs.ucla.edu (Postfix) with ESMTP id 681E73C01084A;
Tue, 29 Jul 2025 12:10:27 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 681E73C01084A
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1753816227;
bh=5xJl13wuSK6XVYq2ixN3oj2qFeOsqna/QRkj21W2TLw=;
h=Message-ID:Date:MIME-Version:To:From;
b=mFuXjzyrHSYcmC578NNkxaDptBte+QiYyQ2Nx2msIJZgotQgQbVzA+MD/07gMOPQO
lNj39KLYxZx00yNvozU159zozbWUdwj7yCABKrDriZfwq3/Z+hgDwHnQfLVGwsppqJ
1eLBIpMd4VihAmCARdhS/4mcYZA8LuYGWQjcbKAl0uhI3/OQQ71dukSETmTjpN4EaP
wPqzr/egaARRaCArfcQ7ytVL2tHjU651GTgrHWz8jOZAvjVh+makP40MWqzOIXS1sS
RYMQ3zdkHwfvpW9JWdV7f0A3SCMvifK/Kxf5K4XQ/tUxj5StmfIf7ZZjmmQE2AxOmN
/p6T/PWhIcxmA==
X-Virus-Scanned: amavis at mail.cs.ucla.edu
Received: from mail.cs.ucla.edu ([127.0.0.1])
by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP
id anFmc1f9wcHY; Tue, 29 Jul 2025 12:10:27 -0700 (PDT)
Received: from penguin.cs.ucla.edu
(47-154-30-222.fdr01.snmn.ca.ip.frontiernet.net [47.154.30.222])
by mail.cs.ucla.edu (Postfix) with ESMTPSA id 3982B3C010841;
Tue, 29 Jul 2025 12:10:27 -0700 (PDT)
Message-ID: <dbe85b01-93d8-4bf3-a712-be4929a992aa@HIDDEN>
Date: Tue, 29 Jul 2025 12:10:26 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#47243: pr lacks -p
To: Collin Funk <collin.funk1@HIDDEN>
References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN>
<87y0s98dmn.fsf@HIDDEN>
<3f06b63f-e96b-4b31-bbf6-7edf446b69ae@HIDDEN>
<8734ah8atg.fsf@HIDDEN> <87tt2x6w59.fsf@HIDDEN>
<da614b77-81b5-449c-97b2-2e6291bff085@HIDDEN> <878qk9kqck.fsf@HIDDEN>
<0fcb335b-cfa1-4ad7-8db2-fafcff18eed3@HIDDEN>
<8fa2295e-39dd-459b-9b1b-fc00573719cc@HIDDEN>
<87pldkqku5.fsf@HIDDEN> <51a2c808-61b7-4f4f-9407-9e7e342366ea@HIDDEN>
<8734af1uh7.fsf@HIDDEN> <cbb07dd8-cd64-465d-9af9-2bd954621c10@HIDDEN>
<87ldo6orb4.fsf@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <87ldo6orb4.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 47243
Cc: 47243 <at> debbugs.gnu.org, =?UTF-8?Q?P=C3=A1draig_Brady?= <P@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
On 2025-07-29 10:11, Collin Funk wrote:
>> And that wasn't the worst device I used to write programs!
> I'm curious, what is the worst?
The IBM 029 card punch, introduced in 1964, was worse.
https://en.wikipedia.org/wiki/Keypunch#IBM_029_Card_Punch
Also, the Qume QVT-102, introduced in 1983. Terrible keyboard. Gave me
carpal tunnel syndrome.
https://terminals-wiki.org/wiki/index.php/Qume_QVT-102
>>> + if (pause_option && close (tty_fd) < 0)
>>> + error (EXIT_FAILURE, errno, "%s", quotef ("/dev/tty"));
>>
>> Why are these lines useful? As far as I can see they merely add
>> complexity for no benefit. How about removing them? (If we kept them
>> we would need to fix the bug in them; but let's remove them.)
>
> I assume we would want to close the file descriptors that we open at the
> end of the program. If so, I guess there is no point in checking for
> errors from 'close'. Or is the close not nessecary, similar to calling
> 'free' on memory just before exit?
Yes, the latter. Files are automatically closed on exit.
We check for error when closing output fds because some filesystems
delay error reporting until close. There's less of a reason to check for
closing input fds just before exit. Here, I can't think of any reason.
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.
Received: (at 47243) by debbugs.gnu.org; 29 Jul 2025 17:11:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 29 13:11:39 2025
Received: from localhost ([127.0.0.1]:35532 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1ugnrX-0007Qi-7s
for submit <at> debbugs.gnu.org; Tue, 29 Jul 2025 13:11:39 -0400
Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:52577)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <collin.funk1@HIDDEN>)
id 1ugnrT-0007Q7-1g
for 47243 <at> debbugs.gnu.org; Tue, 29 Jul 2025 13:11:36 -0400
Received: by mail-pf1-x433.google.com with SMTP id
d2e1a72fcca58-74b54cead6cso3926717b3a.1
for <47243 <at> debbugs.gnu.org>; Tue, 29 Jul 2025 10:11:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1753809089; x=1754413889; darn=debbugs.gnu.org;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=TDJkwP8WuSmuUHtXACjA+kG3jLiSsplX7V4b9IfA+Zo=;
b=c7X+/r0hmTOxepMDLggUcU4chMil9Hjoyu7yJOgAAmNzNszk8KawtGES7EITXlC+rh
ES4ujySZ/krQoU1PoPhjD+wM6OCmq0cP9SGOj3kKrM+gb8D4EypyCf38daTZ25QNzytL
j2gg4+9SIBUuLiJXSoBOVU5tyxZ1DighNCEqPfUCMGWh8Tw1zPkrnketiR+FtjhoesSf
DnV/gd2biag6FbaUH2sLJRMN4G5GxKgPkViaY21xYicQ+bUJHnz+idZ+BoJA008dQZ9R
+fodnBSbx+CdJ625Z1wL4Es3+DH4Yo7tbksuNgliwhhi0RyMew1s3YjQwCTAwbfHWZWC
yJjg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1753809089; x=1754413889;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=TDJkwP8WuSmuUHtXACjA+kG3jLiSsplX7V4b9IfA+Zo=;
b=kuROmNzWLKDGoctb9k4BjiYFmLPXs0adcqc+oLM0fXeWD8QIysFOGtDs9Y5Aqv1cC2
lW2SdwUyN6e6CVsgMsMVz+x3jR+vLqic9ZGax+EsnimQk+Q/fX8bUSwTOkRZJw1KGdK2
kRzIVGIDu3XWia2puWZBuCsz0QPgGbhjq8oLDmyC+05k0sXrmTTda3p6+uxSUAGqlCnN
jrSWH6HiliftscHVGoTCZeb7wpypRHMRdjD+Qb2u9xYQFxKxWrZgtEqlxoRBvyf/6lGC
YlvLo1C5k6rj440cN+aOMLUS0UtJo9tC/wkOQ+DaZSkW/C+o4Kraqf8v5QA+zAEtjflI
vDJQ==
X-Gm-Message-State: AOJu0YxEMQKaB8L4/xRSYssxjOvZfjxGeZMNuDTXfPxIqPiA+3anWJpO
EKeJaBXRpflXlbvmVAy7qyYo7uDtgvJC8irIyhE/si1HQ2iWRljLg1aA
X-Gm-Gg: ASbGncuBnUCFpo2hbF9RBmPW3HskryegMJlXYUExgX+9kxzb1yDHhGtIVIb54ctbjZT
YhfDECGropPUPIjti7zkKJsl7jSCAbeiJSV5tHbt46UdHCCVeesu8DeYZsF3Qouf5/grEnXZ0Gz
ZYrk4e+/A0CoSuIdyMXk438nWygyDvwLr6KB9Lajwrw8CZsQOdNLmtnVCnSaN6aM7hLuN+o35BU
djwyAhCmq3qxGCg6INcf6t74kQ9aumT9aQl50N/DFRyqodkXC2aIrI3dqj8W+YwfGs46ekbYSmL
gHtOp5Bse1bUk5ysIDCtcEeDrE6g2pYicgx6Jk6atUvY30urUWV2Y7+zLxEi85TUDOBzr9+4IQq
ZVY0=
X-Google-Smtp-Source: AGHT+IHB7Zxh4AiFstyuCHwoZDwSs21Ti3K/cZFfJA1Wc0SBbODvX7JYUJczl6E/t+mhB9g/iLS9yA==
X-Received: by 2002:a05:6a20:5491:b0:230:69f1:620a with SMTP id
adf61e73a8af0-23dc10a622dmr236677637.42.1753809088655;
Tue, 29 Jul 2025 10:11:28 -0700 (PDT)
Received: from fedora ([2601:646:8081:3770::c971])
by smtp.gmail.com with ESMTPSA id
d2e1a72fcca58-76408c023b8sm8002538b3a.34.2025.07.29.10.11.27
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 29 Jul 2025 10:11:28 -0700 (PDT)
From: Collin Funk <collin.funk1@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
Subject: Re: bug#47243: pr lacks -p
In-Reply-To: <cbb07dd8-cd64-465d-9af9-2bd954621c10@HIDDEN>
References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN>
<87y0s98dmn.fsf@HIDDEN>
<3f06b63f-e96b-4b31-bbf6-7edf446b69ae@HIDDEN>
<8734ah8atg.fsf@HIDDEN> <87tt2x6w59.fsf@HIDDEN>
<da614b77-81b5-449c-97b2-2e6291bff085@HIDDEN>
<878qk9kqck.fsf@HIDDEN>
<0fcb335b-cfa1-4ad7-8db2-fafcff18eed3@HIDDEN>
<8fa2295e-39dd-459b-9b1b-fc00573719cc@HIDDEN>
<87pldkqku5.fsf@HIDDEN>
<51a2c808-61b7-4f4f-9407-9e7e342366ea@HIDDEN>
<8734af1uh7.fsf@HIDDEN>
<cbb07dd8-cd64-465d-9af9-2bd954621c10@HIDDEN>
Date: Tue, 29 Jul 2025 10:11:27 -0700
Message-ID: <87ldo6orb4.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 47243
Cc: 47243 <at> debbugs.gnu.org, =?utf-8?Q?P=C3=A1draig?= Brady <P@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)
Paul Eggert <eggert@HIDDEN> writes:
> On 2025-07-28 21:39, Collin Funk wrote:
>
>> Thanks for again for the thorough review and explanations. I find it
>> funny that I assumed this change was simple and learned it's purpose was
>> for logging in on a teletype. The Model 37 predates me ~30 years, so it
>> never occured to me that the purpose was to not print logins.
>
> Heh, in the 1960s I used a Teletype Model 33, which was so bad that
> nobody ever wanted to print anything nice on it and 'pr' would have
> never gotten these flags if all people had were Model 33s. And that
> wasn't the worst device I used to write programs!
I'm curious, what is the worst?
>> +After printing each page, print an alert (bell) to standard error and
>> +wait for a newline to be read from @file{/dev/tty} before printing the
>> +next page.
>
> This sentence should start "Before" not "After", with the rest of the
> sentence changed accordingly. There is no bell printed after the last
> page.
>
> Looking at the code, it seems that this mistake has leaked into the
> code as well, in that sometimes 'pr' will print an alert and wait for
> '\n' at end of file, when there is no page to print. If I'm right,
> that needs to be fixed; pr should wait for '\n' only if it will
> actually print something afterward.
Good catch, I guess the logic of checking if there are more pages to
print should be hoisted out of 'print_page ()' or the pausing logic
should be handled there, just before printing. Let me see which one is
less of a chore to read.
>> + if (pause_option && close (tty_fd) < 0)
>> + error (EXIT_FAILURE, errno, "%s", quotef ("/dev/tty"));
>
> Why are these lines useful? As far as I can see they merely add
> complexity for no benefit. How about removing them? (If we kept them
> we would need to fix the bug in them; but let's remove them.)
I assume we would want to close the file descriptors that we open at the
end of the program. If so, I guess there is no point in checking for
errors from 'close'. Or is the close not nessecary, similar to calling
'free' on memory just before exit?
>> + if (putc ('\a', stderr) == EOF || fflush (stderr) != 0)
>
> fputc here; there's no need for efficiency since we're gonna fflush anyway.
>
> More important, this fputc and fflush should be skipped if
> pause_option is false.
That was my interpretation as well. But I noticed that FreeBSD and
NetBSD will print the alert using 'pr -f'. Since both of us agree that
is wrong, I will change it.
> You might want to turn this part of the code into a separate static
> function, for clarity. (Or you might not....)
Yep, at first the conditions were too small to benefit from an extra
function. But over time it is beginning to make more sense...
Thanks,
Collin
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.
Received: (at 47243) by debbugs.gnu.org; 29 Jul 2025 08:06:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 29 04:06:48 2025
Received: from localhost ([127.0.0.1]:60081 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1ugfMG-00018C-1y
for submit <at> debbugs.gnu.org; Tue, 29 Jul 2025 04:06:48 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66]:41350)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eggert@HIDDEN>)
id 1ugfMD-00017l-Cr
for 47243 <at> debbugs.gnu.org; Tue, 29 Jul 2025 04:06:46 -0400
Received: from localhost (localhost [127.0.0.1])
by mail.cs.ucla.edu (Postfix) with ESMTP id B161A3C010841;
Tue, 29 Jul 2025 01:06:38 -0700 (PDT)
Received: from mail.cs.ucla.edu ([127.0.0.1])
by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP
id jlel2p7XSO6e; Tue, 29 Jul 2025 01:06:38 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
by mail.cs.ucla.edu (Postfix) with ESMTP id 8813A3C01084A;
Tue, 29 Jul 2025 01:06:38 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 8813A3C01084A
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1753776398;
bh=nRJSxFJAE60iS9pIM9b8BZ5kdVAb8qUb8que0fM1bvc=;
h=Message-ID:Date:MIME-Version:To:From;
b=P62Da/BDfNzlEoCrgB1hoGvmvFf3LfvDzb7G/3tE2DVHUlkx7vh3Ta6s6PSaeZbOr
LoVFHpZjegevSsmqhwb55OakNj4jZkmU4tBLynNJyR4yNkC5cQkolMza3XjlMs1KD5
G4ONfcCRYguSh9GREignwPr40oAW/VCuCwnGET9JrYXPRx+p7hKABOHMBnQjjVWSn4
Y/1rs8e792fjAh0OF2QLiBw6oE2rgkRhSU1/PAhkg7EzutOzrLBg81QXNesQNaAevL
zz0/YrbNihXXlFaPB1msCBbtKHcKUZlnZvepMxbIKYKfzVLnnm8I2mXAcY0wT3g4IJ
7wIn/MAoTMVrg==
X-Virus-Scanned: amavis at mail.cs.ucla.edu
Received: from mail.cs.ucla.edu ([127.0.0.1])
by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP
id FYXkISI-3iYn; Tue, 29 Jul 2025 01:06:38 -0700 (PDT)
Received: from penguin.cs.ucla.edu
(47-154-30-222.fdr01.snmn.ca.ip.frontiernet.net [47.154.30.222])
by mail.cs.ucla.edu (Postfix) with ESMTPSA id 5712A3C010841;
Tue, 29 Jul 2025 01:06:38 -0700 (PDT)
Message-ID: <cbb07dd8-cd64-465d-9af9-2bd954621c10@HIDDEN>
Date: Tue, 29 Jul 2025 01:06:37 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#47243: pr lacks -p
To: Collin Funk <collin.funk1@HIDDEN>
References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN>
<87y0s98dmn.fsf@HIDDEN>
<3f06b63f-e96b-4b31-bbf6-7edf446b69ae@HIDDEN>
<8734ah8atg.fsf@HIDDEN> <87tt2x6w59.fsf@HIDDEN>
<da614b77-81b5-449c-97b2-2e6291bff085@HIDDEN> <878qk9kqck.fsf@HIDDEN>
<0fcb335b-cfa1-4ad7-8db2-fafcff18eed3@HIDDEN>
<8fa2295e-39dd-459b-9b1b-fc00573719cc@HIDDEN>
<87pldkqku5.fsf@HIDDEN> <51a2c808-61b7-4f4f-9407-9e7e342366ea@HIDDEN>
<8734af1uh7.fsf@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <8734af1uh7.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 47243
Cc: 47243 <at> debbugs.gnu.org, =?UTF-8?Q?P=C3=A1draig_Brady?= <P@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
On 2025-07-28 21:39, Collin Funk wrote:
> Thanks for again for the thorough review and explanations. I find it
> funny that I assumed this change was simple and learned it's purpose was
> for logging in on a teletype. The Model 37 predates me ~30 years, so it
> never occured to me that the purpose was to not print logins.
Heh, in the 1960s I used a Teletype Model 33, which was so bad that
nobody ever wanted to print anything nice on it and 'pr' would have
never gotten these flags if all people had were Model 33s. And that
wasn't the worst device I used to write programs!
but I digress....
> + pr now supports the -p option, to pause upon printing each page until
> + a newline character is read from /dev/tty, as required by POSIX. The
> + corresponding long option is --pause.
Change "upon" to "before".
> +After printing each page, print an alert (bell) to standard error and
> +wait for a newline to be read from @file{/dev/tty} before printing the
> +next page.
This sentence should start "Before" not "After", with the rest of the
sentence changed accordingly. There is no bell printed after the last page.
Looking at the code, it seems that this mistake has leaked into the code
as well, in that sometimes 'pr' will print an alert and wait for '\n' at
end of file, when there is no page to print. If I'm right, that needs to
be fixed; pr should wait for '\n' only if it will actually print
something afterward.
> +@vindex POSIXLY_CORRECT
> +If the @env{POSIXLY_CORRECT} environment variable is set and standard
> +output is not a tty, this option will be ignored.
Better wording is to start "This option is ignored if...". And change
"not a tty" to "not associated with a terminal". Similarly for the other
"not a tty"s. (Few people these days know that "tty" is short for
"Teletype"....)
> +/* If true, pause after each page until a newline is read from /dev/tty. */
"after" -> "before"
> +static bool pause_option;
> +
> +/* If true, pause on only the first page. */
The "only" sounds wrong, if both flags are set. I would omit "only".
Also, change "on" to "before".
> + /* POSIX states that the pausing behavior of -f and -p should only occur if
"should only occur" -> "should occur only"
> + if (pause_option && close (tty_fd) < 0)
> + error (EXIT_FAILURE, errno, "%s", quotef ("/dev/tty"));
Why are these lines useful? As far as I can see they merely add
complexity for no benefit. How about removing them? (If we kept them we
would need to fix the bug in them; but let's remove them.)
> + unsigned char ch;
Make it plain char; there's no reason it needs to be unsigned.
> + if (putc ('\a', stderr) == EOF || fflush (stderr) != 0)
fputc here; there's no need for efficiency since we're gonna fflush anyway.
More important, this fputc and fflush should be skipped if pause_option
is false.
You might want to turn this part of the code into a separate static
function, for clarity. (Or you might not....)
> I assumed this change was simple
And you were right: it will be simple, once we get it done right....
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.
Received: (at 47243) by debbugs.gnu.org; 29 Jul 2025 04:39:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 29 00:39:28 2025
Received: from localhost ([127.0.0.1]:59411 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1ugc7b-0001MW-U0
for submit <at> debbugs.gnu.org; Tue, 29 Jul 2025 00:39:28 -0400
Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:56554)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <collin.funk1@HIDDEN>)
id 1ugc7Y-0001MB-H1
for 47243 <at> debbugs.gnu.org; Tue, 29 Jul 2025 00:39:25 -0400
Received: by mail-pf1-x42e.google.com with SMTP id
d2e1a72fcca58-7425bd5a83aso4876953b3a.0
for <47243 <at> debbugs.gnu.org>; Mon, 28 Jul 2025 21:39:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1753763958; x=1754368758; darn=debbugs.gnu.org;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=CPF2IdM6g6yboTsmh5CRQtvczBHZVSbb/ESDA8H/Btw=;
b=T4qUFtwhiZ7BtjwsKc0d25B3p0q90GVGgYBleHNSpPfRSZ/gaLHVmmPrtdUVLdgX+c
wsbbYx7xBpymKixi6/1SbkIlcWiQ8XRTIB5daOg4QHWoVd5f8mVnkqoh77VmiVuYzpjt
b6vkgTHWrY2FRseNbtgpBOyNJSk2lonbbGYj50VwRu8Cy998JI3jleYxoiLtfhqbpzU6
q3e8xsPuQ6T2ZJIAoZGnp4LPEZALJN/SGdKLj0BFaJLKDXUD3NSVsFVMhFo/utNBG+z0
g0etoQgv7VUN96mmWaA4yIumpITWX5SjZh+vULMKK3VECjBsKznMuuWymvjNnP85EJOF
UhmQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1753763958; x=1754368758;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=CPF2IdM6g6yboTsmh5CRQtvczBHZVSbb/ESDA8H/Btw=;
b=ru/0cTK6jNoffWzoCGR4gJMuzgF4hL78iyJx8gVDBO05eyE5VIRssKPWX1WW07SyaR
TX7VeA0FELz6L28pHx8QRlBTIKVC3E/cB+fOGCxVN0ogJtCCk4Gkjlyq/b80TCdyiJLY
kh6DR6KH3SxV3cJ7BkqxcWo8c6ozZB07rBiDythNq6PyWVgMceg9bkeTvQz6qi5elHwS
fq+MlZqlb2srbRV0ZZ6NHSyOKlgGsKyRYURrF/x9cJmALddJ0BN/NIpfIE24IAENnIOF
lYVp5DwwX3iLGV/CyLRHNjxiW16SqCZw9UCy0+RM+jdufo8GFHR+df3SUz+kJZzuRgr1
JHRw==
X-Gm-Message-State: AOJu0Yx7Vh0bdcc5WCMc/F/170yE+eHU/Ag42qLSZabF5FuWCMU1rLeH
GooqGTa7fl46iMIBfyid8phi9BNZsRmHf9gejVz0n7fxG1jk0+p7rC5q
X-Gm-Gg: ASbGnctq11j4lHNBbo5/khgvfeok5JD0LHNAsvuswkA6WsD3IPaWnlaqOvHus5MaLMO
RhFkOq2bHSFrSDRCgOyYGmQ7KSpXjISvxVNa8ijfsw109FD5fuh5Tsm3aIIij/P4GZ7CVanGgA5
zcd3IyDvFWnNlviTZnRWnXyBsaNCVEz4r8Yk1Kcu6kFyTCgwhNPfEJUTpH+Y6uuM9R60KkvlISJ
KRLYQZYy5lCWpxZT62XFkBDMO8OPqu7Bkf4+mozWUe47+pexLGuFC3zkGRnRiDFVfob9FeJzcmW
0sis4LQl6CXJ0HGkRhwT6BBmr+LQMc5rFKMZJgYuYENLz0ykeDpIQD5Ij5TlNU/UHsuBeAKlvq4
jXIo=
X-Google-Smtp-Source: AGHT+IHq8JUYIomyWvzdgQVo7cIK9rXRpxwgnwBbSFfci7czNvmp+NiF77cGS88hxNSqVlBJ/tT7Tg==
X-Received: by 2002:a05:6a00:2e82:b0:736:5f75:4a3b with SMTP id
d2e1a72fcca58-76334aaf608mr18994044b3a.7.1753763958136;
Mon, 28 Jul 2025 21:39:18 -0700 (PDT)
Received: from fedora ([2601:646:8081:3770::c971])
by smtp.gmail.com with ESMTPSA id
d2e1a72fcca58-7640b2dcdb4sm6754748b3a.100.2025.07.28.21.39.17
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Mon, 28 Jul 2025 21:39:17 -0700 (PDT)
From: Collin Funk <collin.funk1@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
Subject: Re: bug#47243: pr lacks -p
In-Reply-To: <51a2c808-61b7-4f4f-9407-9e7e342366ea@HIDDEN>
References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN>
<87y0s98dmn.fsf@HIDDEN>
<3f06b63f-e96b-4b31-bbf6-7edf446b69ae@HIDDEN>
<8734ah8atg.fsf@HIDDEN> <87tt2x6w59.fsf@HIDDEN>
<da614b77-81b5-449c-97b2-2e6291bff085@HIDDEN>
<878qk9kqck.fsf@HIDDEN>
<0fcb335b-cfa1-4ad7-8db2-fafcff18eed3@HIDDEN>
<8fa2295e-39dd-459b-9b1b-fc00573719cc@HIDDEN>
<87pldkqku5.fsf@HIDDEN>
<51a2c808-61b7-4f4f-9407-9e7e342366ea@HIDDEN>
Date: Mon, 28 Jul 2025 21:39:16 -0700
Message-ID: <8734af1uh7.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 47243
Cc: 47243 <at> debbugs.gnu.org, =?utf-8?Q?P=C3=A1draig?= Brady <P@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)
--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Paul Eggert <eggert@HIDDEN> writes:
> On 2025-07-28 10:36, Collin Funk wrote:
>> I don't really like the idea of changing '-f' depending on whether
>> POSIXLY_CORRECT is defined. So I would prefer this as well.
>
> On second thought (sorry...) I now think I understand why GNU pr
> behaves the way it does. The GNU coding standards[1] say "...please
> don=E2=80=99t make the behavior of a command-line program depend on the t=
ype
> of output device it gets as standard output or standard input. Device
> independence is an important principle of the system=E2=80=99s design; do=
not
> compromise it merely to save someone from typing an option now and
> then."
>
> The standards go on to list some exceptions, such as 'ls'. 'pr' is not
> one of the exceptions. Currently there are a few other exceptions in
> Coreutils ('df', 'mv', 'nohup', 'rm', 'tail') but I guess 'pr' didn't
> make the cut when it was written.
>
> That is, my theory is that when GNU 'pr' was written, its original
> author Pete TerMaat followed the GNU coding standards, and
> deliberately made '-f' and '-F' aliases, because that way the behavior
> of pr would not depend on isatty (STDOUT_FILENO). And Pete did not
> implement -p because it didn't sound useful if we follow the coding
> standards.
>
> If this theory is correct, then a fix that would be more in the spirit
> of GNU would be something like this:
Interesting, I did not know about this part of the GNU Coding Standards.
> (a) Implement -p as if isatty (STDOUT_FILENO) is true. This form of -p
> is useful only when stdout is a terminal, but that's good enough since
> nobody uses (or will use :-) -p.
>
> (b) If POSIXLY_CORRECT is set, change -f and -p so that they both
> worry about isatty (STDOUT_FILENO), as POSIX requires.
>
> This would conform to POSIX, would address P=C3=A1draig's concern about
> compatibility, and would follow the GNU coding standards.
That sounds good to me. I attached a v4 patch that should behave this
way and address the other issues that you mentioned.
> It'd be less useful in practice, but that doesn't matter since the
> practical need for this behavior vanished decades ago.
Thanks for again for the thorough review and explanations. I find it
funny that I assumed this change was simple and learned it's purpose was
for logging in on a teletype. The Model 37 predates me ~30 years, so it
never occured to me that the purpose was to not print logins.
Collin
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
filename=v4-0001-pr-implement-p-and-modify-f-conforming-to-POSIX.patch
From bb063435c2019af6a6b9e26c67c4b378b9243919 Mon Sep 17 00:00:00 2001
Message-ID: <bb063435c2019af6a6b9e26c67c4b378b9243919.1753762640.git.collin.funk1@HIDDEN>
From: Collin Funk <collin.funk1@HIDDEN>
Date: Sun, 27 Jul 2025 15:00:15 -0700
Subject: [PATCH v4] pr: implement '-p' and modify '-f' conforming to POSIX
* src/pr.c (pause_option, pause_on_first_page, tty_fd): New variables.
(short_options): Add '-p'.
(long_options): Add '--pause'.
(main): Add the option. Open and close a file descriptor to
/dev/tty. Disable pausing if POSIXLY_CORRECT is set.
(print_files): If the pausing is enabled, emit '\a' to standard error
and wait until a newline is read to print the next page.
(usage): Mention the new option.
* doc/coreutils.texi (pr invocation): Document the new option. Document
the behaviors of POSIXLY_CORRECT on -p and -f.
* NEWS: Mention the new option. Mention the new behavior of 'pr -f' with
the POSIXLY_CORRECT environment variable set.
---
NEWS | 7 +++++
doc/coreutils.texi | 17 ++++++++++++
src/pr.c | 66 +++++++++++++++++++++++++++++++++++++++++++---
3 files changed, 86 insertions(+), 4 deletions(-)
diff --git a/NEWS b/NEWS
index 0b2be7116..6e78c81d3 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,9 @@ GNU coreutils NEWS -*- outline -*-
'factor' is now much faster at identifying large prime numbers,
and significantly faster on composite numbers greater than 2^128.
+ 'pr -f' with the POSIXLY_CORRECT environment variable set will pause
+ until a newline is read from /dev/tty before printing the first page.
+
** Bug fixes
cksum was not compilable by Apple LLVM 10.0.0 x86-64, which
@@ -64,6 +67,10 @@ GNU coreutils NEWS -*- outline -*-
Iranian locale (fa_IR) and for the Ethiopian locale (am_ET), and also
does so more consistently for the Thailand locale (th_TH.UTF-8).
+ pr now supports the -p option, to pause upon printing each page until
+ a newline character is read from /dev/tty, as required by POSIX. The
+ corresponding long option is --pause.
+
* Noteworthy changes in release 9.7 (2025-04-09) [stable]
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 7ca5b222c..25e4e4e51 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -2726,6 +2726,11 @@ @node pr invocation
Use a form feed instead of newlines to separate output pages. This does
not alter the default page length of 66 lines.
+@vindex POSIXLY_CORRECT
+If the @env{POSIXLY_CORRECT} environment variable is set and standard
+output is a tty, then using @option{-f} will also pause until a newline
+is read from @file{/dev/tty} before printing the first page.
+
@item -h @var{header}
@itemx --header=@var{header}
@opindex -h
@@ -2825,6 +2830,18 @@ @node pr invocation
set with the @option{-W/-w} option. A limited overflow may occur with
numbered single column output (compare @option{-n} option).
+@item -p
+@itemx --pause
+@opindex -p
+@opindex --pause
+After printing each page, print an alert (bell) to standard error and
+wait for a newline to be read from @file{/dev/tty} before printing the
+next page.
+
+@vindex POSIXLY_CORRECT
+If the @env{POSIXLY_CORRECT} environment variable is set and standard
+output is not a tty, this option will be ignored.
+
@item -r
@itemx --no-file-warnings
@opindex -r
diff --git a/src/pr.c b/src/pr.c
index e7081a059..298be4ebd 100644
--- a/src/pr.c
+++ b/src/pr.c
@@ -711,6 +711,15 @@ static char *custom_header;
/* (-D) Date format for the header. */
static char const *date_format;
+/* If true, pause after each page until a newline is read from /dev/tty. */
+static bool pause_option;
+
+/* If true, pause on only the first page. */
+static bool pause_on_first_page;
+
+/* Used to read from /dev/tty if --p/--pause is in use. */
+static int tty_fd;
+
/* The local time zone rules, as per the TZ environment variable. */
static timezone_t localtz;
@@ -738,7 +747,7 @@ enum
};
static char const short_options[] =
- "-0123456789D:FJN:S::TW:abcde::fh:i::l:mn::o:rs::tvw:";
+ "-0123456789D:FJN:S::TW:abcde::fh:i::l:mn::po:rs::tvw:";
static struct option const long_options[] =
{
@@ -758,6 +767,7 @@ static struct option const long_options[] =
{"number-lines", optional_argument, nullptr, 'n'},
{"first-line-number", required_argument, nullptr, 'N'},
{"indent", required_argument, nullptr, 'o'},
+ {"pause", no_argument, nullptr, 'p'},
{"no-file-warnings", no_argument, nullptr, 'r'},
{"separator", optional_argument, nullptr, 's'},
{"sep-string", optional_argument, nullptr, 'S'},
@@ -868,6 +878,8 @@ main (int argc, char **argv)
idx_t n_digits = 0;
idx_t n_alloc = 0;
+ bool posixly_correct = (getenv ("POSIXLY_CORRECT") != nullptr);
+
initialize_main (&argc, &argv);
set_program_name (argv[0]);
setlocale (LC_ALL, "");
@@ -958,6 +970,8 @@ main (int argc, char **argv)
untabify_input = true;
break;
case 'f':
+ pause_on_first_page = posixly_correct;
+ FALLTHROUGH;
case 'F':
use_form_feed = true;
break;
@@ -999,6 +1013,9 @@ main (int argc, char **argv)
chars_per_margin = getoptnum (optarg, 0,
_("'-o MARGIN' invalid line offset"));
break;
+ case 'p':
+ pause_option = true;
+ break;
case 'r':
ignore_failed_opens = true;
break;
@@ -1061,7 +1078,7 @@ main (int argc, char **argv)
}
if (! date_format)
- date_format = (getenv ("POSIXLY_CORRECT") && !hard_locale (LC_TIME)
+ date_format = (posixly_correct && !hard_locale (LC_TIME)
? "%b %e %H:%M %Y"
: "%Y-%m-%d %H:%M");
@@ -1079,6 +1096,22 @@ main (int argc, char **argv)
error (EXIT_FAILURE, 0,
_("cannot specify both printing across and printing in parallel"));
+ /* POSIX states that the pausing behavior of -f and -p should only occur if
+ standard output is a tty. Only behave this way is POSIXLY_CORRECT is set
+ since the GNU Coding Standards discourages changing program behavior based
+ on output device type. */
+ if ((pause_option || pause_on_first_page) && posixly_correct
+ && ! isatty (STDOUT_FILENO))
+ pause_option = pause_on_first_page = false;
+
+ if (pause_option || pause_on_first_page)
+ {
+ tty_fd = open ("/dev/tty", O_RDONLY);
+ if (tty_fd < 0)
+ error (EXIT_FAILURE, errno, _("cannot open %s for reading"),
+ quoteaf ("/dev/tty"));
+ }
+
/* Translate some old short options to new/long options.
To meet downward compatibility with other UNIX pr utilities
and some POSIX specifications. */
@@ -1149,6 +1182,8 @@ main (int argc, char **argv)
if (have_read_stdin && fclose (stdin) == EOF)
error (EXIT_FAILURE, errno, _("standard input"));
+ if (pause_option && close (tty_fd) < 0)
+ error (EXIT_FAILURE, errno, "%s", quotef ("/dev/tty"));
main_exit (failed_opens ? EXIT_FAILURE : EXIT_SUCCESS);
}
@@ -1636,8 +1671,29 @@ print_files (int number_of_files, char **av)
init_funcs ();
line_number = line_count;
- while (print_page ())
- ;
+ while (true)
+ {
+ if (pause_option || (pause_on_first_page && page_number == 1))
+ {
+ if (putc ('\a', stderr) == EOF || fflush (stderr) != 0)
+ write_error ();
+ while (true)
+ {
+ unsigned char ch;
+ ssize_t bytes_read = read (tty_fd, &ch, sizeof ch);
+ if (bytes_read < 0)
+ error (EXIT_FAILURE, errno, _("error reading %s"),
+ quoteaf ("/dev/tty"));
+ /* Just exit if the user presses Ctrl-D. */
+ if (bytes_read == 0)
+ return;
+ if (ch == '\n')
+ break;
+ }
+ }
+ if (! print_page ())
+ break;
+ }
}
/* Initialize header information.
@@ -2824,6 +2880,8 @@ Paginate or columnate FILE(s) for printing.\n\
-o, --indent=MARGIN\n\
offset each line with MARGIN (zero) spaces, do not\n\
affect -w or -W, MARGIN will be added to PAGE_WIDTH\n\
+ -p, --pause pause at the beginning of each page until a newline\n\
+ is read from /dev/tty.\n\
-r, --no-file-warnings\n\
omit warning when a file cannot be opened\n\
"), stdout);
--
2.50.1
--=-=-=--
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.
Received: (at 47243) by debbugs.gnu.org; 28 Jul 2025 18:07:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 28 14:07:06 2025
Received: from localhost ([127.0.0.1]:57214 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1ugSFd-0005rA-Re
for submit <at> debbugs.gnu.org; Mon, 28 Jul 2025 14:07:06 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66]:49382)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eggert@HIDDEN>)
id 1ugSFa-0005qM-Ix
for 47243 <at> debbugs.gnu.org; Mon, 28 Jul 2025 14:07:03 -0400
Received: from localhost (localhost [127.0.0.1])
by mail.cs.ucla.edu (Postfix) with ESMTP id 2FEA03C010860;
Mon, 28 Jul 2025 11:06:56 -0700 (PDT)
Received: from mail.cs.ucla.edu ([127.0.0.1])
by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP
id U53oMV-F9i26; Mon, 28 Jul 2025 11:06:56 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
by mail.cs.ucla.edu (Postfix) with ESMTP id 06F4D3C010873;
Mon, 28 Jul 2025 11:06:56 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 06F4D3C010873
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1753726016;
bh=1qd/uPWBfLLfS2/0TaJM8eWc2sNcK7dUrnENDvreW9E=;
h=Message-ID:Date:MIME-Version:To:From;
b=QqYjTwBhxDViaDEi7gABKb0TpiLWgXIugoR5v3C0ByMRbJx5aSzOvW56bCHn9MxGF
J8fz8GOo+RI8LBCPsbG8SxWxmbih7Gq/VOC304hhPxSBC0uPsFr2hs3nFtRm9gSOZb
mPnKzMpAEusN2TgWNWBKaZZAgQcUjB7CZBUXjDKIzAs/xgTd78zTwDSA7XCVYwDG/h
FDFqK9uzgta9lOcedxfaZiKXBoVToO0E92KbWBxOPxIWbjT3XxuCVrCzcUbjM95e2s
v1B28TID9Rtoatq8UfqcsAHHBLVD4LRjNSybd2GuKwRn71ADXGjdXKSm15Q5l1CpSw
GDeii8mQy46vg==
X-Virus-Scanned: amavis at mail.cs.ucla.edu
Received: from mail.cs.ucla.edu ([127.0.0.1])
by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP
id QnvsfeJOlneg; Mon, 28 Jul 2025 11:06:55 -0700 (PDT)
Received: from penguin.cs.ucla.edu (unknown [47.154.30.222])
by mail.cs.ucla.edu (Postfix) with ESMTPSA id D46383C010860;
Mon, 28 Jul 2025 11:06:55 -0700 (PDT)
Message-ID: <51a2c808-61b7-4f4f-9407-9e7e342366ea@HIDDEN>
Date: Mon, 28 Jul 2025 11:06:55 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#47243: pr lacks -p
To: Collin Funk <collin.funk1@HIDDEN>
References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN>
<87y0s98dmn.fsf@HIDDEN>
<3f06b63f-e96b-4b31-bbf6-7edf446b69ae@HIDDEN>
<8734ah8atg.fsf@HIDDEN> <87tt2x6w59.fsf@HIDDEN>
<da614b77-81b5-449c-97b2-2e6291bff085@HIDDEN> <878qk9kqck.fsf@HIDDEN>
<0fcb335b-cfa1-4ad7-8db2-fafcff18eed3@HIDDEN>
<8fa2295e-39dd-459b-9b1b-fc00573719cc@HIDDEN>
<87pldkqku5.fsf@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <87pldkqku5.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 47243
Cc: 47243 <at> debbugs.gnu.org, =?UTF-8?Q?P=C3=A1draig_Brady?= <P@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
On 2025-07-28 10:36, Collin Funk wrote:
> I don't really like the idea of changing '-f' depending on whether
> POSIXLY_CORRECT is defined. So I would prefer this as well.
On second thought (sorry...) I now think I understand why GNU pr behaves=20
the way it does. The GNU coding standards[1] say "...please don=E2=80=99t=
make=20
the behavior of a command-line program depend on the type of output=20
device it gets as standard output or standard input. Device independence=20
is an important principle of the system=E2=80=99s design; do not compromi=
se it=20
merely to save someone from typing an option now and then."
The standards go on to list some exceptions, such as 'ls'. 'pr' is not=20
one of the exceptions. Currently there are a few other exceptions in=20
Coreutils ('df', 'mv', 'nohup', 'rm', 'tail') but I guess 'pr' didn't=20
make the cut when it was written.
That is, my theory is that when GNU 'pr' was written, its original=20
author Pete TerMaat followed the GNU coding standards, and deliberately=20
made '-f' and '-F' aliases, because that way the behavior of pr would=20
not depend on isatty (STDOUT_FILENO). And Pete did not implement -p=20
because it didn't sound useful if we follow the coding standards.
If this theory is correct, then a fix that would be more in the spirit=20
of GNU would be something like this:
(a) Implement -p as if isatty (STDOUT_FILENO) is true. This form of -p=20
is useful only when stdout is a terminal, but that's good enough since=20
nobody uses (or will use :-) -p.
(b) If POSIXLY_CORRECT is set, change -f and -p so that they both worry=20
about isatty (STDOUT_FILENO), as POSIX requires.
This would conform to POSIX, would address P=C3=A1draig's concern about=20
compatibility, and would follow the GNU coding standards. It'd be less=20
useful in practice, but that doesn't matter since the practical need for=20
this behavior vanished decades ago.
Sound good enough?
[1]: https://www.gnu.org/prep/standards/html_node/User-Interfaces.html
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.Received: (at 47243) by debbugs.gnu.org; 28 Jul 2025 17:36:14 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 28 13:36:13 2025 Received: from localhost ([127.0.0.1]:57108 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ugRll-0003pe-IT for submit <at> debbugs.gnu.org; Mon, 28 Jul 2025 13:36:13 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:57480) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <collin.funk1@HIDDEN>) id 1ugRlj-0003pH-Jx for 47243 <at> debbugs.gnu.org; Mon, 28 Jul 2025 13:36:12 -0400 Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-313910f392dso3537396a91.2 for <47243 <at> debbugs.gnu.org>; Mon, 28 Jul 2025 10:36:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753724165; x=1754328965; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=acPT+nCtrX978Ld5A4f1MdyG4btnLxjGT2fURTV0umg=; b=HuL3W15VBeOa60xXXvEeGTm3yTwgwFxBunLpLiBYfaMztmMgMfqNIhcA2nDDQWCKPn Z8M5bDp3Fl3/S/zRThy+2x2od4Rts4ecAD/z87J7V9cCrLkksKXn89+RV6hXelsvJZST qUru947salktfrxhBLndv5BTAa/F7aV/INNOEp/VUFqgM54dm9rJIm84gS5Yf6NrQVMT 9y0ZT+1WsGXf2/h1FsgOPohnro/DDZNcCJhMpoPQtSTPtSDsMv4ufwP5NeRkV+7iv9jO WhYeq9zte12mxZ/jmmcCKJhgjcUGSMQ3UlpeJghXvS8I7AQdl5sxj0DkxNvk145at8pg ek2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753724165; x=1754328965; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=acPT+nCtrX978Ld5A4f1MdyG4btnLxjGT2fURTV0umg=; b=C0yNoRufHHQwEW1GZAHWAr/j8HI9baZVs6111TeBkRtg+41br3gUjXGHPHdpqQQNtH gd8eGDMjVOcKuszrLkbpBed/0nSesr7vgnQ9Jb6RfgpxwePHpiYuFSbJ+Xq+sBcikCAb 71O+hGj/m6tkTZ7+/YNPFYfs0mQz57uolcyIEnoy79oCf6wTCDTEBAesdVCHcB7WcSzB PXulGmRXLixFs6p/Md+khNxLXj6ids2SNGymZ38DqXz4TsxADtE9A3XFfNpFqqRBZ7tn BUVQgduvgqajfh25bOJ8+RxV3yZY/Ry+EikI3Ce3iomcGbJlKw/dTrlEIPlmNYXoFeUA +EFA== X-Gm-Message-State: AOJu0YzEy3dWlUI5qxBc5YtPHywRaKJuOjKQBQLyVpvxeGayfHeZj3/0 Rv8cFACqHkpicdiPfBWSoThyI+nINZYwtqNU1A4LaqLrv2AM2/axC8IVZrusmg== X-Gm-Gg: ASbGncsTHIDXafsAatnkeh84pKks4b0V20CKQ+P/laSWnHEnEa1UMDsn7Pe55ilgTvy eOOlrVk7mYzikuUG0HbXielqoZE1jR2aNE5VGNq7jXdkfrfPP/VNVEdr3OD6Ky4z2lQDDxyFrJW DMHaKCOyIF38zetYDq+VsmjrpHqerIYxVDDu+FT8ebizrIfyen0yDJnbWlYmNBRKVrMjskGgpjV ZEdTl7ps2/mE/A2O89W/jqzMcr6UmgWVAxAq1lv+z3AXQwujHGq5hieFjj6SuqBMAUY74lshaoK Lldqx8Z8GK0rso7K5xgqrPjs87CO5JeF/GhD8/eqp0Xk4GLPd/WTgOkhmQN/y4XZ2SX9yEkrw2A N3oktIKhWKLYNlQ== X-Google-Smtp-Source: AGHT+IFKAT9ygZetV4EIWoXUSbfdqh+Mh31o4XAhYgd2n7Q8OiBedx5eBcgWmzCzbvKKVyXhEagQWg== X-Received: by 2002:a17:90b:564e:b0:311:c1ec:7d0a with SMTP id 98e67ed59e1d1-31e77a01249mr17289806a91.25.1753724164778; Mon, 28 Jul 2025 10:36:04 -0700 (PDT) Received: from fedora ([2601:646:8081:3770::e9a2]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-31e66270f48sm10010971a91.10.2025.07.28.10.36.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Jul 2025 10:36:03 -0700 (PDT) From: Collin Funk <collin.funk1@HIDDEN> To: =?utf-8?Q?P=C3=A1draig?= Brady <P@HIDDEN> Subject: Re: bug#47243: pr lacks -p In-Reply-To: <8fa2295e-39dd-459b-9b1b-fc00573719cc@HIDDEN> References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN> <87y0s98dmn.fsf@HIDDEN> <3f06b63f-e96b-4b31-bbf6-7edf446b69ae@HIDDEN> <8734ah8atg.fsf@HIDDEN> <87tt2x6w59.fsf@HIDDEN> <da614b77-81b5-449c-97b2-2e6291bff085@HIDDEN> <878qk9kqck.fsf@HIDDEN> <0fcb335b-cfa1-4ad7-8db2-fafcff18eed3@HIDDEN> <8fa2295e-39dd-459b-9b1b-fc00573719cc@HIDDEN> Date: Mon, 28 Jul 2025 10:36:02 -0700 Message-ID: <87pldkqku5.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 47243 Cc: 47243 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.7 (/) P=C3=A1draig Brady <P@HIDDEN> writes: > Reading POSIX more closely I see there is also pause logic for the first = page only: > -f [XSI] [Option Start] Use a <form-feed> for new pages, instead of = the default behavior that uses a sequence of <newline> characters. > Pause before beginning the first page if the standard output is a= ssociated with a terminal. [Option End] Thanks, I'll have a look. > I presume you're waiting until the implementation solidifies, > but just in case, a couple of basic tests to show > that -p is accepted at least would be good. Yep, I was going to add some simple tests afterwards. Paul Eggert said: > On 2025-07-28 09:23, P=C3=A1draig Brady wrote: >> Yes it's a fair point. >> We don't want existing scripts that use -f to start pausing unexpectedly. >> I suppose this is a case for only pausing with -f if POSIXLY_CORRECT >> env var is set. > Although backward compatibility is an issue, the current behavior is > clearly wrong for the intended use of -f, which is for logins via > printing terminals so stdout is the printer. So a better way to think > about it is that this is merely a longstanding obscure bug in GNU 'pr' > that we can fix. > > The only reason we haven't noticed the bug before, is that nobody has > seriously used those terminals in decades, so nobody has run into the > bug and taken the time to report it. > > Other 'pr' implementations (e.g., FreeBSD) do the right thing here, > and I see no significant reason (other than inertia) for us to be both > wrong for the intended use and incompatible with the rest of the > world. I don't really like the idea of changing '-f' depending on whether POSIXLY_CORRECT is defined. So I would prefer this as well. I'll write another patch later today based on your other emails as well. Collin
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.Received: (at 47243) by debbugs.gnu.org; 28 Jul 2025 16:57:39 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 28 12:57:39 2025 Received: from localhost ([127.0.0.1]:56980 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ugRAQ-0001LF-QY for submit <at> debbugs.gnu.org; Mon, 28 Jul 2025 12:57:39 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:35924) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eggert@HIDDEN>) id 1ugRAO-0001Kq-7W for 47243 <at> debbugs.gnu.org; Mon, 28 Jul 2025 12:57:37 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id A2EDB3C010860 for <47243 <at> debbugs.gnu.org>; Mon, 28 Jul 2025 09:57:30 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id KUfNW3za-Rau for <47243 <at> debbugs.gnu.org>; Mon, 28 Jul 2025 09:57:30 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 7E06E3C010873 for <47243 <at> debbugs.gnu.org>; Mon, 28 Jul 2025 09:57:30 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 7E06E3C010873 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1753721850; bh=jf7n+iIfnWq+7dCeGUNgbVyxCzF8Yv7YRPBTIb751ic=; h=Message-ID:Date:MIME-Version:To:From; b=qcbeNFKsplKM14AzGgd1bnDeYX1cr2W2Ecpg4dCaYelYFGWMrr2yCtxN3pzP+YbeA N6jSQPzTXnHlF4bsaMlzXjKDo8KX0gqQhQCFEh5ThxruvZekwtYtC/VymlMZRb+8gp FhJyrW/c1zZ5R0TK1BefjIYbH1+ljv2GuY5oOtANX5PvZREDAiUPVO8u+uh0kSGNfF vFwfX22FR17IEO8+gAXgZETVCTCfgdaZrflP2I1D0dek1Cyh03zQYIPOrwGOBIjGaz wz4C//vnaZUeeMCGt6gueTTXNNWxvi7ewmDPqWZhxxFaDPIXF3ajE54sPzI7ZBj4W9 4wHJty/2Ht/bg== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id GTQJx3GuPSZN for <47243 <at> debbugs.gnu.org>; Mon, 28 Jul 2025 09:57:30 -0700 (PDT) Received: from penguin.cs.ucla.edu (unknown [47.154.30.222]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 57BE23C010860 for <47243 <at> debbugs.gnu.org>; Mon, 28 Jul 2025 09:57:30 -0700 (PDT) Message-ID: <62691fc9-109d-4c20-87b0-bafd12fb5878@HIDDEN> Date: Mon, 28 Jul 2025 09:57:30 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#47243: pr lacks -p To: 47243 <at> debbugs.gnu.org References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN> <E1ugQMx-00000005gQ3-01j0@HIDDEN> Content-Language: en-US From: Paul Eggert <eggert@HIDDEN> Organization: UCLA Computer Science Department In-Reply-To: <E1ugQMx-00000005gQ3-01j0@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 47243 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On 2025-07-28 09:06, Stan Marsh wrote: > The point is that -f is already taken; it is a synonym for -F. That's a bug in GNU 'pr'. -f is supposed to mean "act like -F but also pause before the first page if standard output is a terminal". See <https://pubs.opengroup.org/onlinepubs/9799919799/utilities/pr.html#tag_20_95_04>.
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.Received: (at 47243) by debbugs.gnu.org; 28 Jul 2025 16:54:07 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 28 12:54:07 2025 Received: from localhost ([127.0.0.1]:56967 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ugR70-00014C-P6 for submit <at> debbugs.gnu.org; Mon, 28 Jul 2025 12:54:06 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:33784) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eggert@HIDDEN>) id 1ugR6y-00013T-6e for 47243 <at> debbugs.gnu.org; Mon, 28 Jul 2025 12:54:05 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id ABB7E3C010860; Mon, 28 Jul 2025 09:53:57 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id NDJjtxxfR6Nz; Mon, 28 Jul 2025 09:53:57 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 7F5F33C010873; Mon, 28 Jul 2025 09:53:57 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 7F5F33C010873 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1753721637; bh=BBpgGVrcJAlm/B0nryc/OmLYC6DrPjSgbX5tJ53/+1w=; h=Message-ID:Date:MIME-Version:To:From; b=PxyK7M5G4VFaw83ZLVGlnuacMAJeuq2ivsulRyjNzkyb9TucijDkanVs6YL+WdZsh 0pjZq0L9sAjq8IoOL+IE5x/1n0qxwdAlQD18luIsJCwx7jpBRbhi4TrDr4xcpiKlld CigR89mG6ivQYh05zofJ++KdfBlfprqYR97lP6zhiAW2flsSKVYy3RC0T/D/8tjHTD 1ffaRhc6fXlILIxkYAhqw6oifubkAxKubidR2iV/J1huEkMYzst/dmPRP6zBIur3CE KsYErg3liQ0trXyDzKGE3ive90LchH6JHgDQ5PqDK26oi8M9Jl+2Xg5/Y+ztr/OiME NL1xFSEeB3+4g== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id us54MfU2dxQh; Mon, 28 Jul 2025 09:53:57 -0700 (PDT) Received: from penguin.cs.ucla.edu (unknown [47.154.30.222]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 5BC7F3C010860; Mon, 28 Jul 2025 09:53:57 -0700 (PDT) Message-ID: <0c25deeb-4e9d-4085-9b3a-263853c22be2@HIDDEN> Date: Mon, 28 Jul 2025 09:53:57 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#47243: pr lacks -p To: =?UTF-8?Q?P=C3=A1draig_Brady?= <P@HIDDEN> References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN> <E1ugQMx-00000005gQ3-01j0@HIDDEN> <87416235-4ec4-4a95-8cf4-45a15ae84699@HIDDEN> Content-Language: en-US From: Paul Eggert <eggert@HIDDEN> Organization: UCLA Computer Science Department In-Reply-To: <87416235-4ec4-4a95-8cf4-45a15ae84699@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 47243 Cc: 47243 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On 2025-07-28 09:23, P=C3=A1draig Brady wrote: > Yes it's a fair point. > We don't want existing scripts that use -f to start pausing unexpectedl= y. > I suppose this is a case for only pausing with -f if POSIXLY_CORRECT > env var is set. Although backward compatibility is an issue, the current behavior is=20 clearly wrong for the intended use of -f, which is for logins via=20 printing terminals so stdout is the printer. So a better way to think=20 about it is that this is merely a longstanding obscure bug in GNU 'pr'=20 that we can fix. The only reason we haven't noticed the bug before, is that nobody has=20 seriously used those terminals in decades, so nobody has run into the=20 bug and taken the time to report it. Other 'pr' implementations (e.g., FreeBSD) do the right thing here, and=20 I see no significant reason (other than inertia) for us to be both wrong=20 for the intended use and incompatible with the rest of the world.
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.Received: (at 47243) by debbugs.gnu.org; 28 Jul 2025 16:23:41 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 28 12:23:41 2025 Received: from localhost ([127.0.0.1]:56886 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ugQdZ-0007bc-Bm for submit <at> debbugs.gnu.org; Mon, 28 Jul 2025 12:23:41 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:48280) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <pixelbeat@HIDDEN>) id 1ugQdX-0007b4-1Q for 47243 <at> debbugs.gnu.org; Mon, 28 Jul 2025 12:23:39 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-45610582d07so29886155e9.0 for <47243 <at> debbugs.gnu.org>; Mon, 28 Jul 2025 09:23:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753719812; x=1754324612; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=/1+dcDKuxIu9dx0TJjOSHVtW4ozrw8mK+w0/zte+6QM=; b=YV/1uxhv30l4LJHZ7Me0p4NsUk3b30cUM8mjpk8geekM1dFhMSwKRdD48a9teCNBDa 5lLYp8BBzuzUlqRFQ/uVDM7gVXLeNC4AeYPPgN/agOt0e3ZdATTsZeketwrKAajIYJ6o nCN/SdrWBkJBOFSl30csprvP2fh4VnW8qZDfFK3PSWzA8UaKEyXJITZJdgVl5S0HNMfM Dp6FiJJaNNd7gcxbvqstzXUZsNaI3bD+9Dug18HQMmP2XRaJHRV1o9BBlGTxk8ESMNym HySD8uOex4v7LnxOwE1xPoeDHz4bzWjgiF8wAROdZavno9HU3Fk/mCtQKQo5VplkzVvP q5/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753719812; x=1754324612; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/1+dcDKuxIu9dx0TJjOSHVtW4ozrw8mK+w0/zte+6QM=; b=kN8Np/XCG4kANDxppIkgXJvDZ1fVbEga2dRS5GZHMgp9Ts1iggYDiM0NqsoeHv+arx WNOx004V+LTNW5ACkGNREQGt3kdQ2Te4r3NhCGSW3sKnJDCPK8RmVu1Uhl4aZdiBrI2J azhura1bpn7butBuo8LNw2OF2HpT0inSRw7II/X9CibPkKbKPak46R5Ix/++fflCjcLq /ziFmEQ/MD9DYoHxE7JK7LotcxLbCHuB4IDn8ZeK17EUTDO8TiOaEeGO/hbn0R5lLNbz ssRCqIuV9DafGvf59LzWH21PRDvrwTFC9QHwFqNzH7RUTTRZ29xVleioiySSWQjhNDmw cnew== X-Gm-Message-State: AOJu0Yx3V4ASnsUQhuI7Lgnp9amdprv3Oidrc1ptYBIgIaMPD+qLYmnn wfFhXpFpSG3MQ2aPZgqBFbFpd1VYC9pT8SKKrMEWvoWiJLz+vBLatitYB4M4aQ== X-Gm-Gg: ASbGnctUaB2qlXMhK3lOgzeujhkCcq4J9kimsJ/L67TiKx65T8ytEyNYaEYIi9WXudk Gjp9d7AjI8Qp10qlXt7m0oa7Tc6MxiAKjTpgGT0C2NWtUAjb5G0aXbWuBzesYfWa4D5EPfl5wkh SQzE7+6ocLF+Lix/NSo9HyE8XF7iz4YKIq+s+712VfT4d34ORMvTYcgLu8Z8BAHHWNAmbCpG3l2 BNZwra7/FmcGqoD9lUkjekjpwUnX8bPcuFwVBU5QM6LGanhoXMouOefTkQ/h9/h2gpLb3m4oI0o 8+an7fZQgQFrqtHKTHRZoIXepaMqJIo4c3Mq7w7E2pyn2qGXloxB2BMoGc4DdmwzBe3V0YjxYwR 8RPCSpD64+p4bq86gs3of/jZhYIpGfy4eXIx3GTX/pfjDIxJKATzoxeVOF30z9lGI28QL6A0CUu lv+Q== X-Google-Smtp-Source: AGHT+IG33XmNqXS1D7SJyyOwSzvYoUygH3v8v8XBjpIjrqLRmTKtgaszpnyylNytZ46YAdvJRjnMdg== X-Received: by 2002:a05:600c:a088:b0:456:1608:c807 with SMTP id 5b1f17b1804b1-4588adc3677mr21709885e9.26.1753719811922; Mon, 28 Jul 2025 09:23:31 -0700 (PDT) Received: from [192.168.1.31] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4587ac7553dsm104079005e9.30.2025.07.28.09.23.31 for <47243 <at> debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Jul 2025 09:23:31 -0700 (PDT) Message-ID: <87416235-4ec4-4a95-8cf4-45a15ae84699@HIDDEN> Date: Mon, 28 Jul 2025 17:23:30 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: bug#47243: pr lacks -p To: 47243 <at> debbugs.gnu.org References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN> <E1ugQMx-00000005gQ3-01j0@HIDDEN> Content-Language: en-US From: =?UTF-8?Q?P=C3=A1draig_Brady?= <P@HIDDEN> In-Reply-To: <E1ugQMx-00000005gQ3-01j0@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 47243 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On 28/07/2025 17:06, Stan Marsh wrote: > Paul wrote: > >> Then Pádraig Brady wrote: >>> Reading POSIX more closely I see there is also pause logic for the first page >>> only: >>> -f [XSI] [Option Start] Use a <form-feed> for new pages, instead of the > -------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (!) >>> default >>> behavior that uses a sequence of <newline> characters. >>> Pause before beginning the first page if the standard output is >>> associated with a terminal. [Option End] > >>> How can it be both? > > Then Paul wrote: > >> If neither -p nor -f is specified, pr doesn't pause. > >> If -p is specified, pr pauses before every output page, regardless of whether -f is >> also specified. > >> If -f but not -p is specified, pr pauses only before the first output page. > > I think there is a misunderstanding here. > > The point is that -f is already taken; it is a synonym for -F. > > So, it can't be re-purposed to mean: pause only before the first output page, > without breaking any script or human who depends on it meaning: use form feeds. Yes it's a fair point. We don't want existing scripts that use -f to start pausing unexpectedly. I suppose this is a case for only pausing with -f if POSIXLY_CORRECT env var is set. cheers, Padraig
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.
Received: (at submit) by debbugs.gnu.org; 28 Jul 2025 16:06:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 28 12:06:49 2025
Received: from localhost ([127.0.0.1]:56820 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1ugQNF-0006UJ-3G
for submit <at> debbugs.gnu.org; Mon, 28 Jul 2025 12:06:49 -0400
Received: from lists.gnu.org ([2001:470:142::17]:36006)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <gazelle@HIDDEN>)
id 1ugQND-0006Tn-1I
for submit <at> debbugs.gnu.org; Mon, 28 Jul 2025 12:06:48 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <gazelle@HIDDEN>)
id 1ugQN3-00041B-T6
for bug-coreutils@HIDDEN; Mon, 28 Jul 2025 12:06:38 -0400
Received: from out03.mta.xmission.com ([166.70.13.233])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <gazelle@HIDDEN>)
id 1ugQN1-00051N-R3
for bug-coreutils@HIDDEN; Mon, 28 Jul 2025 12:06:37 -0400
Received: from mx03.mta.xmission.com ([166.70.13.213]:56154)
by out03.mta.xmission.com with esmtps (TLS1.3) tls
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93)
(envelope-from <gazelle@HIDDEN>) id 1ugQMy-009D6Y-8Y
for bug-coreutils@HIDDEN; Mon, 28 Jul 2025 10:06:32 -0600
Received: from shell.xmission.com ([166.70.8.4]:56444)
by mx03.mta.xmission.com with esmtps (TLS1.3) tls
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93)
(envelope-from <gazelle@HIDDEN>)
id 1ugQMx-00FXMT-AI; Mon, 28 Jul 2025 10:06:31 -0600
Received: from gazelle by shell.xmission.com with local (Exim 4.97)
(envelope-from <gazelle@HIDDEN>) id 1ugQMx-00000005gQ3-01j0;
Mon, 28 Jul 2025 10:06:31 -0600
To: bug-coreutils@HIDDEN
Subject: bug#47243: pr lacks -p
X-GNUMailList: Yes
Message-Id: <E1ugQMx-00000005gQ3-01j0@HIDDEN>
From: Stan Marsh <gazelle@HIDDEN>
Date: Mon, 28 Jul 2025 10:06:31 -0600
X-XM-SPF: eid=1ugQMx-00FXMT-AI; ; ;
mid=<E1ugQMx-00000005gQ3-01j0@HIDDEN>; ; ;
hst=mx03.mta.xmission.com; ; ; ip=166.70.8.4; ; ; frm=gazelle@HIDDEN; ; ;
spf=softfail
X-SA-Exim-Connect-IP: 166.70.13.213
X-SA-Exim-Rcpt-To: bug-coreutils@HIDDEN
X-SA-Exim-Mail-From: gazelle@HIDDEN
X-SA-Exim-Scanned: No (on out03.mta.xmission.com);
SAEximRunCond expanded to false
Received-SPF: pass client-ip=166.70.13.233; envelope-from=gazelle@HIDDEN;
helo=out03.mta.xmission.com
X-Spam_score_int: -23
X-Spam_score: -2.4
X-Spam_bar: --
X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, PP_MIME_FAKE_ASCII_TEXT=0.244,
RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001,
RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
has NOT identified this incoming email as spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: Paul wrote: >Then Pádraig Brady wrote: >>Reading POSIX more
closely I see there is also pause logic for the first page >>only: >> -f
[XSI] [Option Start] Use a <form-feed> for new pages, instead of the ---------
[...]
Content analysis details: (1.2 points, 10.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/,
no trust
[2001:470:142:0:0:0:0:17 listed in]
[list.dnswl.org]
1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail)
-0.0 SPF_HELO_PASS SPF: HELO matches SPF record
0.2 PP_MIME_FAKE_ASCII_TEXT BODY: MIME text/plain claims to be ASCII
but isn't
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: /dev/null@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)
Paul wrote:
>Then Pádraig Brady wrote:
>>Reading POSIX more closely I see there is also pause logic for the first page
>>only:
>> -f [XSI] [Option Start] Use a <form-feed> for new pages, instead of the
-------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (!)
>>default
>>behavior that uses a sequence of <newline> characters.
>> Pause before beginning the first page if the standard output is
>>associated with a terminal. [Option End]
>> How can it be both?
Then Paul wrote:
>If neither -p nor -f is specified, pr doesn't pause.
>If -p is specified, pr pauses before every output page, regardless of whether -f is
>also specified.
>If -f but not -p is specified, pr pauses only before the first output page.
I think there is a misunderstanding here.
The point is that -f is already taken; it is a synonym for -F.
So, it can't be re-purposed to mean: pause only before the first output page,
without breaking any script or human who depends on it meaning: use form feeds.
=================================================================================
Please do not send me replies to my posts on the list.
I always read the replies via the web archive, so CC'ing to me is unnecessary.
Note that they always end up in my Spam file anyway, so it is annoying
to have to periodically clean that out.
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.
Received: (at 47243) by debbugs.gnu.org; 28 Jul 2025 15:14:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 28 11:14:34 2025
Received: from localhost ([127.0.0.1]:56522 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1ugPYf-0002W4-NE
for submit <at> debbugs.gnu.org; Mon, 28 Jul 2025 11:14:33 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66]:59818)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eggert@HIDDEN>)
id 1ugPYb-0002Vi-Qc
for 47243 <at> debbugs.gnu.org; Mon, 28 Jul 2025 11:14:31 -0400
Received: from localhost (localhost [127.0.0.1])
by mail.cs.ucla.edu (Postfix) with ESMTP id 3C8433C010860;
Mon, 28 Jul 2025 08:14:23 -0700 (PDT)
Received: from mail.cs.ucla.edu ([127.0.0.1])
by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP
id gxnQFRALteOr; Mon, 28 Jul 2025 08:14:23 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
by mail.cs.ucla.edu (Postfix) with ESMTP id 148D33C010873;
Mon, 28 Jul 2025 08:14:23 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 148D33C010873
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1753715663;
bh=Om+Xsmjcd7cFpd+pTYZHYjDI63Vr22562ckQIPSEixU=;
h=Message-ID:Date:MIME-Version:To:From;
b=Ib+0cjMaYLHyQDl6znLWxTJQ3gx9eP71iHTtTYNq4WufoAFhAIUbw1YgL++rqQYCh
Q4UvSykvZ6mDdkpL0X8GWOfGa49XOqxLxK54gGVIA64C1P6WHq5kjvvnO6zaESN16F
0vH1mVkMEFkZBgS4/VgOWIbtr0WfT1zpRGL26pEA7UiYmCIQd57E4CcRvvbYbd1A/I
lawx3AoGVZOo+fkoU3NTCOD2Odp6FSB/9dbPLy/FahsyYT2MO5Pjq/v9SY1Z6QarWL
FTAv0XjKQZzYFI8frIE/+p8m/pMGFQGNTkpc3KG3o4pKMGo8K/RJ2fxYsY9FlM9frx
iim8R2BfIaznQ==
X-Virus-Scanned: amavis at mail.cs.ucla.edu
Received: from mail.cs.ucla.edu ([127.0.0.1])
by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP
id XLPeWhlK1bXo; Mon, 28 Jul 2025 08:14:22 -0700 (PDT)
Received: from penguin.cs.ucla.edu (unknown [47.154.30.222])
by mail.cs.ucla.edu (Postfix) with ESMTPSA id E37353C010860;
Mon, 28 Jul 2025 08:14:22 -0700 (PDT)
Message-ID: <9366c0f7-7669-4f4d-b802-de0a513e2d5f@HIDDEN>
Date: Mon, 28 Jul 2025 08:14:22 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#47243: pr lacks -p
To: Collin Funk <collin.funk1@HIDDEN>
References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN>
<87y0s98dmn.fsf@HIDDEN>
<3f06b63f-e96b-4b31-bbf6-7edf446b69ae@HIDDEN>
<8734ah8atg.fsf@HIDDEN> <87tt2x6w59.fsf@HIDDEN>
<da614b77-81b5-449c-97b2-2e6291bff085@HIDDEN> <878qk9kqck.fsf@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <878qk9kqck.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 47243
Cc: 47243 <at> debbugs.gnu.org, =?UTF-8?Q?P=C3=A1draig_Brady?= <P@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
On 2025-07-27 19:21, Collin Funk wrote:
> I think that v3 attached should cover everything.
In addition to P=C3=A1draig's comments, I would add:
> + a newline character is read from /dev/tty, as required by POSIX Issu=
e
> + 6. The corresponding long option is --pause.
Don't say "Issue 6" as almost nobody knows what that means and it's=20
obsolete anyway. Just say "POSIX".
> + if (ch =3D=3D 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'=20
label.
It's possible for feof and ferror to both be true. In that case, pr=20
should report the error. So, this code should call ferror instead of=20
calling feof.
Come to think of it, why use stdio here? Plain 'open' and 'read' work=20
just as well for this, and avoid possible stdio glitches. There's no=20
real need for stdio's buffering.
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.Received: (at 47243) by debbugs.gnu.org; 28 Jul 2025 15:01:29 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 28 11:01:29 2025 Received: from localhost ([127.0.0.1]:56449 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ugPM0-0001di-MZ for submit <at> debbugs.gnu.org; Mon, 28 Jul 2025 11:01:29 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:43932) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eggert@HIDDEN>) id 1ugPLx-0001d4-B5 for 47243 <at> debbugs.gnu.org; Mon, 28 Jul 2025 11:01:26 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id E8AA63C010860 for <47243 <at> debbugs.gnu.org>; Mon, 28 Jul 2025 08:01:18 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id hU0TJiK6Xubh for <47243 <at> debbugs.gnu.org>; Mon, 28 Jul 2025 08:01:18 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id C2E863C010873 for <47243 <at> debbugs.gnu.org>; Mon, 28 Jul 2025 08:01:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu C2E863C010873 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1753714878; bh=8/egLszRmfR2+DeByI27VKr+/pQlcTNKSd1g0916hnA=; h=Message-ID:Date:MIME-Version:To:From; b=FE4XMCcxy3JscYi0kbkFqUBTxhb2MhN3k5ZIaJaKCu0Zfs2rK+4E2NFdV6G6Jzlj8 IwquHYnUzYIJ+SIpMhgYd1zsK1xmLfMGne89/eY7bCFEvocS7h5etK4g/dD4J7RmZf 7hgBpxPeKfsTxyx010BgFo5yXDYm9Sb2iGIIVAaMmDD/Rxs7aNiJ8imfFGxC0nUQ/n C1iw4QX0BbCWLhfD0bKToAeU1V6lltA/B0nSnplk7xoaC2iCfl84+d7yAulvpq/sH4 +NNlWBvdUI8QSATxdKHF5pp19byXIDbnU4uXjxMkP9IrvnRqZkEdNWMheEBxHfAmPR hktwukQmHBoEw== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id LAuC88itIGHM for <47243 <at> debbugs.gnu.org>; Mon, 28 Jul 2025 08:01:18 -0700 (PDT) Received: from penguin.cs.ucla.edu (unknown [47.154.30.222]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id A4EA03C010860 for <47243 <at> debbugs.gnu.org>; Mon, 28 Jul 2025 08:01:18 -0700 (PDT) Message-ID: <e0ea7d33-b17e-4eef-a58e-62b5472f4044@HIDDEN> Date: Mon, 28 Jul 2025 08:01:18 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#47243: pr lacks -p To: 47243 <at> debbugs.gnu.org References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN> <E1ugP2C-00000005Qyt-453g@HIDDEN> Content-Language: en-US From: Paul Eggert <eggert@HIDDEN> Organization: UCLA Computer Science Department In-Reply-To: <E1ugP2C-00000005Qyt-453g@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 47243 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On 2025-07-28 07:41, Stan Marsh wrote: >> Paul Eggert <eggert@HIDDEN> writes: >=20 >> Thanks for looking into that. Unfortunately POSIX says -p should be >> ignored only if standard output is a terminal, and that newline should > -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >=20 > Shouldn't this be "ignored unless standard output is a terminal" ? Yes, sorry. > Then P=C3=A1draig Brady wrote: >> Reading POSIX more closely I see there is also pause logic for the fir= st page >> only: >> -f [XSI] [Option Start] Use a <form-feed> for new pages, instead = of the default >> behavior that uses a sequence of <newline> characters. >> Pause before beginning the first page if the standard output i= s >> associated with a terminal. [Option End] >=20 > How can it be both? If neither -p nor -f is specified, pr doesn't pause. If -p is specified, pr pauses before every output page, regardless of=20 whether -f is also specified. If -f but not -p is specified, pr pauses only before the first output pag= e. The motivation for -p is that you are using something like a Teletype=20 Model 37[1] to log in, i.e., you are logged in via a printing terminal.=20 But you want to print something out using special paper that you need to=20 load by hand, one sheet at a time, and you don't want your interactive=20 session to appear on that paper. The -f option is also motivated for a device like the Model 37, except=20 you merely want to use the existing multi-sheet paper and tear off the=20 interactive session. Although devices like the Model 37 became obsolete for logins in the=20 1970s (I last used one for that purpose in 1975), apparently enough of=20 them were still being used in older installations that the -p option was=20 added by some well-meaning engineer at AT&T around 1980. (The -p option=20 was not present in 7th edition UNIX, released in 1979.) And POSIX=20 standardized -p - which has not been needed for at least three decades,=20 probably four - and we are now spending time implementing -p for=20 coreutils, time that would be more usefully spent elsewhere. [1]: https://en.wikipedia.org/wiki/Teletype_Model_37
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.Received: (at submit) by debbugs.gnu.org; 28 Jul 2025 14:41:45 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 28 10:41:44 2025 Received: from localhost ([127.0.0.1]:56394 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ugP2u-0000QF-I4 for submit <at> debbugs.gnu.org; Mon, 28 Jul 2025 10:41:44 -0400 Received: from lists.gnu.org ([2001:470:142::17]:44710) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <gazelle@HIDDEN>) id 1ugP2s-0000Pl-0w for submit <at> debbugs.gnu.org; Mon, 28 Jul 2025 10:41:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <gazelle@HIDDEN>) id 1ugP2L-0001XZ-W8 for bug-coreutils@HIDDEN; Mon, 28 Jul 2025 10:41:12 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <gazelle@HIDDEN>) id 1ugP2K-0003YC-1s for bug-coreutils@HIDDEN; Mon, 28 Jul 2025 10:41:09 -0400 Received: from mx03.mta.xmission.com ([166.70.13.213]:41576) by out03.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from <gazelle@HIDDEN>) id 1ugP2D-0094Hg-T4 for bug-coreutils@HIDDEN; Mon, 28 Jul 2025 08:41:02 -0600 Received: from shell.xmission.com ([166.70.8.4]:41558) by mx03.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from <gazelle@HIDDEN>) id 1ugP2D-00FArf-3O; Mon, 28 Jul 2025 08:41:01 -0600 Received: from gazelle by shell.xmission.com with local (Exim 4.97) (envelope-from <gazelle@HIDDEN>) id 1ugP2C-00000005Qyt-453g; Mon, 28 Jul 2025 08:41:00 -0600 To: bug-coreutils@HIDDEN Subject: bug#47243: pr lacks -p X-GNUMailList: Yes Message-Id: <E1ugP2C-00000005Qyt-453g@HIDDEN> From: Stan Marsh <gazelle@HIDDEN> Date: Mon, 28 Jul 2025 08:41:00 -0600 X-XM-SPF: eid=1ugP2D-00FArf-3O; ; ; mid=<E1ugP2C-00000005Qyt-453g@HIDDEN>; ; ; hst=mx03.mta.xmission.com; ; ; ip=166.70.8.4; ; ; frm=gazelle@HIDDEN; ; ; spf=softfail X-SA-Exim-Connect-IP: 166.70.13.213 X-SA-Exim-Rcpt-To: bug-coreutils@HIDDEN X-SA-Exim-Mail-From: gazelle@HIDDEN X-SA-Exim-Scanned: No (on out03.mta.xmission.com); SAEximRunCond expanded to false Received-SPF: pass client-ip=166.70.13.233; envelope-from=gazelle@HIDDEN; helo=out03.mta.xmission.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, PP_MIME_FAKE_ASCII_TEXT=0.244, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: >Paul Eggert <eggert@HIDDEN> writes: >Thanks for looking into that. Unfortunately POSIX says -p should be >ignored only if standard output is a terminal, and that newline should ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.2 PP_MIME_FAKE_ASCII_TEXT BODY: MIME text/plain claims to be ASCII but isn't -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Reply-To: /dev/null@HIDDEN Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.2 (/) >Paul Eggert <eggert@HIDDEN> writes: >Thanks for looking into that. Unfortunately POSIX says -p should be >ignored only if standard output is a terminal, and that newline should -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Shouldn't this be "ignored unless standard output is a terminal" ? >be read from /dev/tty, not from standard input. This is so that users >can pipe into 'pr -p'. So the proposed patch needs some changes. Here >are the issues I found: Then Pádraig Brady wrote: >Reading POSIX more closely I see there is also pause logic for the first page >only: > -f [XSI] [Option Start] Use a <form-feed> for new pages, instead of the default >behavior that uses a sequence of <newline> characters. > Pause before beginning the first page if the standard output is >associated with a terminal. [Option End] How can it be both? And, one wonders, why do both -F and -f do the same thing? (The man page on my system says they do...) Note: I've been using -F with pr since forever; I had no idea (until now) that -f did the same thing. ================================================================================= Please do not send me replies to my posts on the list. I always read the replies via the web archive, so CC'ing to me is unnecessary. Note that they always end up in my Spam file anyway, so it is annoying to have to periodically clean that out.
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.
Received: (at 47243) by debbugs.gnu.org; 28 Jul 2025 13:25:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 28 09:25:50 2025
Received: from localhost ([127.0.0.1]:55344 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1ugNrR-0003vE-SL
for submit <at> debbugs.gnu.org; Mon, 28 Jul 2025 09:25:50 -0400
Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:53660)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <pixelbeat@HIDDEN>)
id 1ugNrO-0003um-53
for 47243 <at> debbugs.gnu.org; Mon, 28 Jul 2025 09:25:47 -0400
Received: by mail-wm1-x334.google.com with SMTP id
5b1f17b1804b1-451d3f72391so41403745e9.3
for <47243 <at> debbugs.gnu.org>; Mon, 28 Jul 2025 06:25:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1753709140; x=1754313940; darn=debbugs.gnu.org;
h=content-transfer-encoding:in-reply-to:content-language:references
:cc:to:from:subject:user-agent:mime-version:date:message-id:sender
:from:to:cc:subject:date:message-id:reply-to;
bh=1sM694gU3D5Vqb0F+cduIIGehC5Cjgo8ghI98d9gY/E=;
b=bLr7NlVfLpLcb/4BqNYdV1RsRdiBD5uGtbfjJpzkYmnUctja7oCS+v5QMBqzJpwoWs
G0WnawXyGUdEFQoQGU3Gh79sFfL6CoIPGzXM/nEdinVZzMlh6DDLDAyDat44Qkn1/OeI
RAnvIstKZc2Eb9+eAn2UBsuDlTQ2yiKQQbzBFv8ZYkI4RL5+QsSRww8ew2AzmteClg0I
VSp7mSdft67XHaIsV0htqz+hTl9SmAzHe1gKxQHDvoMbzap5x4F4LJu+3u44B7Jg9MUK
8EWzv/mtlsPcUhlSp8H7kppycDAcyytl2Y8ieyvg/o629yGCW9Tpz82j1F361YfRnXby
SHvQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1753709140; x=1754313940;
h=content-transfer-encoding:in-reply-to:content-language:references
:cc:to:from:subject:user-agent:mime-version:date:message-id:sender
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=1sM694gU3D5Vqb0F+cduIIGehC5Cjgo8ghI98d9gY/E=;
b=FENaGEOGb662qpqXt09sCWexOAEKDLMzb7l+5ssuvVJqho7nzCjGuuSSB1oJznEy/o
owKOCWajAaOdJ3z3s8Yn+9RLbimrY/7EH5w+z/7vkGS+I4lLeMVw7vhU7hodvLkAqXxd
Jl5lyOkuuOpd1qvq3Pc2WldFKU5/tsE1X4Wk0ksVUv/lmzhFUQi+WDrQjevpPBqRYZ6u
LgJDSiVTTTXIFx2q2nIEDTWZEPHlUAZsQqSb2B7U2GPRjjM03nsMNAw+Y4Vy3PoZV36A
HH/zbtuizgCFLyR60tzP/p86qckZZzDyDavlPNUxG5lE37A+YseV+KtUx6v7qag/+vVD
mRgg==
X-Gm-Message-State: AOJu0Yw7nZgcXyA08rhO2vmaVSCjC3iOhciz4SnOqvi5DY6VzLiUDI30
Q1ym5MBNxJcnJ7C9GU2FNb2FIzAPT1MK6nEj9KQoOAgjqkOOAuOWWwpY
X-Gm-Gg: ASbGncu+cl+SshRfevJdCluD6ak+rwM0ivj2pTXTd6YDtdC5tj6WMkP1CBeCIzKXZUH
SG2fmcd7LvOlbOWSXgu1wxMWJjlfTCc0UokMga5rG0Yzd8ZJMXSSdXpH177gK3zIh7y3RJdli7w
BBJeskJOcBFf4/Z4eFP53+4NgbK8m1m0/jFbDWRmqbZ73u/Ib43vjvbogh6cY4zAskcECMQitCZ
fW5w6JQjd9XWpe/66ZbnVJAmkV7lXwavl6m8327Qh1PZftN9bQOwcU+YM4+4uyXXGMnV/1/M8pN
DBVyliTomqfBTpgaRpdKnkGCmyuhHXyhVDv698QN6XnYXuYihXZrX6OhSbF/FCBOyK1NHkptwom
xa8Yj+uLgRx0FO7p/tx5S0WQzJZrZ199TgNSYtC6yeyq3YnhN3ZwZGqRYxi2jt8XPvvYYN30yak
6lQA==
X-Google-Smtp-Source: AGHT+IFS+V7dNQcg9BuZbZwQNRuHLMFB2vxCzBp7a++4wqGV8eFv+ESCMJnHRyf9wlLNJ/MZO/o7Xg==
X-Received: by 2002:a05:600c:6085:b0:450:d01f:de6f with SMTP id
5b1f17b1804b1-4587631c8f2mr103544925e9.15.1753709139677;
Mon, 28 Jul 2025 06:25:39 -0700 (PDT)
Received: from [192.168.1.31]
(86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146])
by smtp.googlemail.com with ESMTPSA id
ffacd0b85a97d-3b788ec4580sm3054751f8f.45.2025.07.28.06.25.38
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Mon, 28 Jul 2025 06:25:39 -0700 (PDT)
Message-ID: <8fa2295e-39dd-459b-9b1b-fc00573719cc@HIDDEN>
Date: Mon, 28 Jul 2025 14:25:38 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird Beta
Subject: Re: bug#47243: pr lacks -p
From: =?UTF-8?Q?P=C3=A1draig_Brady?= <P@HIDDEN>
To: Collin Funk <collin.funk1@HIDDEN>
References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN>
<87y0s98dmn.fsf@HIDDEN>
<3f06b63f-e96b-4b31-bbf6-7edf446b69ae@HIDDEN>
<8734ah8atg.fsf@HIDDEN> <87tt2x6w59.fsf@HIDDEN>
<da614b77-81b5-449c-97b2-2e6291bff085@HIDDEN> <878qk9kqck.fsf@HIDDEN>
<0fcb335b-cfa1-4ad7-8db2-fafcff18eed3@HIDDEN>
Content-Language: en-US
In-Reply-To: <0fcb335b-cfa1-4ad7-8db2-fafcff18eed3@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 47243
Cc: 47243 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
On 28/07/2025 11:22, Pádraig Brady wrote:
> On 28/07/2025 03:21, Collin Funk wrote:
>> Hi Paul,
>>
>> Paul Eggert <eggert@HIDDEN> writes:
>>
>>> Thanks for looking into that. Unfortunately POSIX says -p should be
>>> ignored only if standard output is a terminal, and that newline should
>>> be read from /dev/tty, not from standard input. This is so that users
>>> can pipe into 'pr -p'. So the proposed patch needs some changes. Here
>>> are the issues I found:
>>
>> Thanks for the thorough review.
>>
>> I think that v3 attached should cover everything.
>>
>> Collin
>>
>
> write_error() manipulates stdout,
> so for the putc(..., stderr) I'd just do a straight error(EXIT_FAILURE, ....)
>
> The NEWS would be best in a "New Features" section.
>
> thanks!
> Padraig
Reading POSIX more closely I see there is also pause logic for the first page only:
-f [XSI] [Option Start] Use a <form-feed> for new pages, instead of the default behavior that uses a sequence of <newline> characters.
Pause before beginning the first page if the standard output is associated with a terminal. [Option End]
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.Received: (at 47243) by debbugs.gnu.org; 28 Jul 2025 10:22:28 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 28 06:22:28 2025 Received: from localhost ([127.0.0.1]:54538 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ugKzz-0005lG-SS for submit <at> debbugs.gnu.org; Mon, 28 Jul 2025 06:22:28 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:60513) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <pixelbeat@HIDDEN>) id 1ugKzw-0005kR-VV for 47243 <at> debbugs.gnu.org; Mon, 28 Jul 2025 06:22:26 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4561ca74829so45217385e9.0 for <47243 <at> debbugs.gnu.org>; Mon, 28 Jul 2025 03:22:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753698138; x=1754302938; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=BDlVJQNidxHkUt95eAcmgTEwyQQdgTCs+lZIPUzmG6U=; b=A62HLyMLh9taNaAQPchC4OrxEbOg+A7h3hEL2RWQJin/Afix3u5eFIG0MnXckAvSxK AphxpJhJwzmoDqAUgSpKSJGudwymdyaNC0H1L3RGJAAi4h5WeH9Y+8DshYYdxt72lTGS 9NxuTLtaUSjujMfyJODR9sMwlz1bQzGET6M6LItgdSPDntcgDTHTPfTUmTjI/8yx6BjG FaQeyV/U8km4phHxLL8gPPA+lVkA8Fa1aBDoSB8nLyk1Xkh+YUCylfqk3eRI+g+46Lqo W5m99IxZe1uQtQJ7hhg/N7YulbIZ8vRWZfXfgQt5WAdU2Bp9wsF2hbEWG94PT+/LJ580 yo/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753698138; x=1754302938; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BDlVJQNidxHkUt95eAcmgTEwyQQdgTCs+lZIPUzmG6U=; b=IWVQmzF+aTkibTwK3eqeR2Li3ljM+lnKUMNlzoxhq5KK0eJvXnmCUwYM+irCbwJn/n bwKA7uQeTHN6ebhELIhgLC4c42ZNukd54x566CHfU+oyTxnt1ahQrL2ltbVLPIVDzvz+ N7x+NAcNKhuuSFNxL8d0TS28TnTp3yMQmNCFpaFwSBe7Xc3UfvHXuHgDJnqca4UXiQxy xGxrZpodyarB3WrVF3p3RC5QX4AanKf17ZwwAH1rhvAv7GG6/E8nWmyuG3ty99MXxHoO nPWzm03FiqNZVS2D9P7bbGUC7YQReR4vrwGe4uInS8zVsaYV+hyghzElTGGcAv15O3Ri m/tg== X-Gm-Message-State: AOJu0YyKSSqsuKgNE0mgGpNrsusuVmQLPkpzir09FS4K//kisV+cb09W QvgUXBOpQaAlosUUUhO8MoNzHyjZrQsAyHW3nHVNPGCjL1MUiUpR+iE0 X-Gm-Gg: ASbGncv/g5fyUBvR4Cqg4P1sDCffwcbZt4+rN2fTnZFMONw++gdwsxEccqpIRDxCP/c xo6lukK7DuMP+jfJXgeDNNUHKXPiPOmu5seO3GVYqnahcZ/vRoKxtYiH0+crlOPjrCN/ZRTPf0r Gfw/gpidAMLqzqC19/5T7GwZ8mPYWknEju9lr5xJ34/HtzFA/8+iaPIHtcBiaHwFLu/UFanGsV/ Po/LArkw054oNOq3594ydTzkfzcjWkZrQzjhrH/bMuD/hPJ1jPGoXV2NJ04QGg1ZkBhZHZw44AK NdbhAt/SXUF5vw2uqJUa7ydaNZ0OZDPB0LscO9g/n2KzPw8KzHHSRdpxVLcv/DiaR7UecLIDUoj sOeg4bggUfMmI1ZuGiPsYIYfnENFcTHYQhE8EPsJe+L6s05Nbs8TKQM20iPQ1yijyaSCCgerH3I tXDA== X-Google-Smtp-Source: AGHT+IE22UcEqNEOs4iChPJPL0MglKsEOITvqmtGUpii5HJvsZS6PlLZeMd30azzZgnMeCBhAZMpxg== X-Received: by 2002:a05:600c:4695:b0:450:cf42:7565 with SMTP id 5b1f17b1804b1-45877576a18mr68474585e9.23.1753698138096; Mon, 28 Jul 2025 03:22:18 -0700 (PDT) Received: from [192.168.1.31] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-458705ce781sm150264705e9.31.2025.07.28.03.22.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Jul 2025 03:22:17 -0700 (PDT) Message-ID: <0fcb335b-cfa1-4ad7-8db2-fafcff18eed3@HIDDEN> Date: Mon, 28 Jul 2025 11:22:16 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: bug#47243: pr lacks -p To: Collin Funk <collin.funk1@HIDDEN> References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN> <87y0s98dmn.fsf@HIDDEN> <3f06b63f-e96b-4b31-bbf6-7edf446b69ae@HIDDEN> <8734ah8atg.fsf@HIDDEN> <87tt2x6w59.fsf@HIDDEN> <da614b77-81b5-449c-97b2-2e6291bff085@HIDDEN> <878qk9kqck.fsf@HIDDEN> Content-Language: en-US From: =?UTF-8?Q?P=C3=A1draig_Brady?= <P@HIDDEN> In-Reply-To: <878qk9kqck.fsf@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 47243 Cc: 47243 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On 28/07/2025 03:21, Collin Funk wrote: > Hi Paul, > > Paul Eggert <eggert@HIDDEN> writes: > >> Thanks for looking into that. Unfortunately POSIX says -p should be >> ignored only if standard output is a terminal, and that newline should >> be read from /dev/tty, not from standard input. This is so that users >> can pipe into 'pr -p'. So the proposed patch needs some changes. Here >> are the issues I found: > > Thanks for the thorough review. > > I think that v3 attached should cover everything. > > Collin > write_error() manipulates stdout, so for the putc(..., stderr) I'd just do a straight error(EXIT_FAILURE, ....) The NEWS would be best in a "New Features" section. thanks! Padraig
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.
Received: (at 47243) by debbugs.gnu.org; 28 Jul 2025 02:21:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 27 22:21:28 2025
Received: from localhost ([127.0.0.1]:52993 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1ugDUW-000088-58
for submit <at> debbugs.gnu.org; Sun, 27 Jul 2025 22:21:28 -0400
Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:43430)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <collin.funk1@HIDDEN>)
id 1ugDUS-00007b-5M
for 47243 <at> debbugs.gnu.org; Sun, 27 Jul 2025 22:21:25 -0400
Received: by mail-pf1-x434.google.com with SMTP id
d2e1a72fcca58-74af4af04fdso3567698b3a.1
for <47243 <at> debbugs.gnu.org>; Sun, 27 Jul 2025 19:21:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1753669278; x=1754274078; darn=debbugs.gnu.org;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=F3Xi0tj8rMwzoTvEDQRA2NnHDHm1F5OqLcgHzOkEEqs=;
b=Ma8iYxrIlIY/Zj7qajhmLMeA4y5GmHxXNCrB0yEPJjTlG61tawNQsCEgIlmrHwqDzP
aYKRAAxEOmVw0zCvvynTkLmLM4TjRllvpL8Of6eUyIn3L0bO3bSBxFJ+JJpzzx2Ry+hp
TMB+oE+jPrIqkAA1owqT6Gicj/eKTarLtRw132OoEK7wpJaL1gRVqa6/01tsiGolLkes
YD5V/0DC/lKm1VYx7aTzOya0irfIyE14Ip/NhgSMV+VVuIN1BLXTzlQXlHeYeOzFz8Jw
U4zTZZ7yvH7g//BuD4y0LZC735Okgslsv8zyogHAUh06bGbI1C3vVx032O5yq0DuuXk6
jlFw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1753669278; x=1754274078;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=F3Xi0tj8rMwzoTvEDQRA2NnHDHm1F5OqLcgHzOkEEqs=;
b=gaJPJWYNPmY+TuqUBKEacJWVx0YVG+a5uGJnvQz3sUuc7IIOg+2b7XTFGh9uF/BtjE
LulWwNW50pZgPS298qaHTmRxS8siycKnv6aQFQEsMepRz33dRbFNzg5LbtdhE7qdvl5N
lxbbCgujTy3/aWwyCGYnI7q6qKrXbDOx1uS9x42lckBOcV7j6rO3FaIHOmVnUzr22+ik
lJBX1MW4iZx2sFjpvLyAgHeGFWCYy3/1BO2EbZiZPZTD8qZzt4BGGhVmY1t03tmesxh3
Gz7A8xgqieJV9gjqSCSM92VYELNA0p/V+bpgfEoWd9a4fRB0/JmpX4xSVgRzCkt0A7bH
c9bw==
X-Forwarded-Encrypted: i=1;
AJvYcCXbC8+Oy7BLB21B0Z9SBwq9yZ34HsVSHp9yEXU/FoXlFEMD6JFejJwXY9tjKldDem6ttlOSFQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YyHyTT7yGCHLNkBOpfZ37pu0h/yqaCC37UFzHzAapx4/RR1/DtH
xTIQvsHwzOEW4Eo9zpdcf6Wb/dRCye3ypyR8bigvY/VILqP5L+Oy4ekfgbIzbA==
X-Gm-Gg: ASbGnctvwSLa4/SsmGKXD1aplp/kzdr6eA9u6l9fAxCSkkOaGGflpwuNnqG8akQaT8b
vrAAiXfu/HcdsCQXxH3Bx1UIJ3lbQ1JtITKQFLqwMuiQBu5PwzRtQZA0jkotvemjKCdQGrFsklZ
mJWtzwVMovnExi0x7CNaHkN360yno2ce2Foa23uvxHTyBmeozyRKSqArjofYu4+hqSfqk9iiXS6
VTVqM0x/eS1uzWEZzcSLvtuMHRJfgGpjlw3cJsw0vxRohq4VlvpKxAZTS+rlp/soUFTha3hqE0S
vYfl5HDFUGgX6b2dpmopZl0TNQJTntcn5Nmm6mZpB5lSFSQncnMg8ILbv3SWxGvA85H1x6bniDs
H41w=
X-Google-Smtp-Source: AGHT+IFaXNfk7+XPFCaZcRM47ybtAXIR54QE57qWjIis/SxSfVa7meDENMak0lu9s0AyEAls8megqg==
X-Received: by 2002:a05:6a21:33aa:b0:23d:6475:40aa with SMTP id
adf61e73a8af0-23d6dc126bbmr16145626637.0.1753669277547;
Sun, 27 Jul 2025 19:21:17 -0700 (PDT)
Received: from fedora ([2601:646:8081:3770::e9a2])
by smtp.gmail.com with ESMTPSA id
d2e1a72fcca58-7640872a53dsm4320040b3a.1.2025.07.27.19.21.16
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sun, 27 Jul 2025 19:21:17 -0700 (PDT)
From: Collin Funk <collin.funk1@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
Subject: Re: bug#47243: pr lacks -p
In-Reply-To: <da614b77-81b5-449c-97b2-2e6291bff085@HIDDEN>
References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN>
<87y0s98dmn.fsf@HIDDEN>
<3f06b63f-e96b-4b31-bbf6-7edf446b69ae@HIDDEN>
<8734ah8atg.fsf@HIDDEN> <87tt2x6w59.fsf@HIDDEN>
<da614b77-81b5-449c-97b2-2e6291bff085@HIDDEN>
Date: Sun, 27 Jul 2025 19:21:15 -0700
Message-ID: <878qk9kqck.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 47243
Cc: 47243 <at> debbugs.gnu.org, =?utf-8?Q?P=C3=A1draig?= Brady <P@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)
--=-=-=
Content-Type: text/plain
Hi Paul,
Paul Eggert <eggert@HIDDEN> writes:
> Thanks for looking into that. Unfortunately POSIX says -p should be
> ignored only if standard output is a terminal, and that newline should
> be read from /dev/tty, not from standard input. This is so that users
> can pipe into 'pr -p'. So the proposed patch needs some changes. Here
> are the issues I found:
Thanks for the thorough review.
I think that v3 attached should cover everything.
Collin
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
filename=v3-0001-pr-implement-p-as-required-by-POSIX-Issue-6.patch
From 79dc6d5cfbc45966cd039a599c7db372452b1a9a Mon Sep 17 00:00:00 2001
Message-ID: <79dc6d5cfbc45966cd039a599c7db372452b1a9a.1753669052.git.collin.funk1@HIDDEN>
From: Collin Funk <collin.funk1@HIDDEN>
Date: Sun, 27 Jul 2025 15:00:15 -0700
Subject: [PATCH v3] pr: implement '-p' as required by POSIX Issue 6
* src/pr.c (pause_option): New variable.
(tty_fp): Likewise.
(short_options): Add '-p'.
(long_options): Add '--pause'.
(main): Add the option. Ignore it if standard output is not a tty. Open
a 'FILE *' for /dev/tty and fail if any operations on it are
unsuccessful.
(print_files): If the option is use emit '\a' to stderr and wait until a
newline is read to print the next page.
(usage): Mention the new option.
* doc/coreutils.texi (pr invocation): Document the new option.
* NEWS: Mention the new option.
---
NEWS | 4 ++++
doc/coreutils.texi | 8 +++++++
src/pr.c | 55 +++++++++++++++++++++++++++++++++++++++++++---
3 files changed, 64 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index 0b2be7116..776932c69 100644
--- a/NEWS
+++ b/NEWS
@@ -64,6 +64,10 @@ GNU coreutils NEWS -*- outline -*-
Iranian locale (fa_IR) and for the Ethiopian locale (am_ET), and also
does so more consistently for the Thailand locale (th_TH.UTF-8).
+ pr now supports the -p option, to pause upon printing each page until
+ a newline character is read from /dev/tty, as required by POSIX Issue
+ 6. The corresponding long option is --pause.
+
* Noteworthy changes in release 9.7 (2025-04-09) [stable]
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 7ca5b222c..a8193f5ff 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -2825,6 +2825,14 @@ @node pr invocation
set with the @option{-W/-w} option. A limited overflow may occur with
numbered single column output (compare @option{-n} option).
+@item -p
+@itemx --pause
+@opindex -p
+@opindex --pause
+After printing each page, print an alert (bell) to standard error and
+wait for a newline to be read from @file{/dev/tty} before printing the
+next page. This option is ignored unless standard output is a tty.
+
@item -r
@itemx --no-file-warnings
@opindex -r
diff --git a/src/pr.c b/src/pr.c
index e7081a059..22e752675 100644
--- a/src/pr.c
+++ b/src/pr.c
@@ -711,6 +711,12 @@ static char *custom_header;
/* (-D) Date format for the header. */
static char const *date_format;
+/* If true, pause after each page until a newline is read from /dev/tty. */
+static bool pause_option;
+
+/* Used to read from /dev/tty if --p/--pause is in use. */
+static FILE *tty_fp;
+
/* The local time zone rules, as per the TZ environment variable. */
static timezone_t localtz;
@@ -738,7 +744,7 @@ enum
};
static char const short_options[] =
- "-0123456789D:FJN:S::TW:abcde::fh:i::l:mn::o:rs::tvw:";
+ "-0123456789D:FJN:S::TW:abcde::fh:i::l:mn::po:rs::tvw:";
static struct option const long_options[] =
{
@@ -758,6 +764,7 @@ static struct option const long_options[] =
{"number-lines", optional_argument, nullptr, 'n'},
{"first-line-number", required_argument, nullptr, 'N'},
{"indent", required_argument, nullptr, 'o'},
+ {"pause", no_argument, nullptr, 'p'},
{"no-file-warnings", no_argument, nullptr, 'r'},
{"separator", optional_argument, nullptr, 's'},
{"sep-string", optional_argument, nullptr, 'S'},
@@ -999,6 +1006,9 @@ main (int argc, char **argv)
chars_per_margin = getoptnum (optarg, 0,
_("'-o MARGIN' invalid line offset"));
break;
+ case 'p':
+ pause_option = true;
+ break;
case 'r':
ignore_failed_opens = true;
break;
@@ -1079,6 +1089,18 @@ main (int argc, char **argv)
error (EXIT_FAILURE, 0,
_("cannot specify both printing across and printing in parallel"));
+ if (pause_option)
+ {
+ pause_option = isatty (STDOUT_FILENO);
+ if (pause_option)
+ {
+ tty_fp = fopen ("/dev/tty", "r");
+ if (tty_fp == nullptr)
+ error (EXIT_FAILURE, errno, _("cannot open %s for reading"),
+ quoteaf ("/dev/tty"));
+ }
+ }
+
/* Translate some old short options to new/long options.
To meet downward compatibility with other UNIX pr utilities
and some POSIX specifications. */
@@ -1149,6 +1171,8 @@ main (int argc, char **argv)
if (have_read_stdin && fclose (stdin) == EOF)
error (EXIT_FAILURE, errno, _("standard input"));
+ if (pause_option && fclose (tty_fp) == EOF)
+ error (EXIT_FAILURE, errno, "%s", quotef ("/dev/tty"));
main_exit (failed_opens ? EXIT_FAILURE : EXIT_SUCCESS);
}
@@ -1636,8 +1660,31 @@ print_files (int number_of_files, char **av)
init_funcs ();
line_number = line_count;
- while (print_page ())
- ;
+ for (;;)
+ {
+ if (pause_option)
+ {
+ if (putc ('\a', stderr) == EOF || fflush (stderr) != 0)
+ write_error ();
+ for (;;)
+ {
+ int ch = getc (tty_fp);
+ 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"));
+ }
+ if (ch == '\n')
+ break;
+ }
+ }
+ if (! print_page ())
+ break;
+ }
+ finish:
}
/* Initialize header information.
@@ -2824,6 +2871,8 @@ Paginate or columnate FILE(s) for printing.\n\
-o, --indent=MARGIN\n\
offset each line with MARGIN (zero) spaces, do not\n\
affect -w or -W, MARGIN will be added to PAGE_WIDTH\n\
+ -p, --pause pause at the beginning of each page until a newline\n\
+ is read from /dev/tty.\n\
-r, --no-file-warnings\n\
omit warning when a file cannot be opened\n\
"), stdout);
--
2.50.1
--=-=-=--
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.
Received: (at 47243) by debbugs.gnu.org; 28 Jul 2025 00:26:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 27 20:26:36 2025
Received: from localhost ([127.0.0.1]:52579 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1ugBhL-0006O3-V2
for submit <at> debbugs.gnu.org; Sun, 27 Jul 2025 20:26:36 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66]:33490)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eggert@HIDDEN>)
id 1ugBhH-0006NW-QO
for 47243 <at> debbugs.gnu.org; Sun, 27 Jul 2025 20:26:34 -0400
Received: from localhost (localhost [127.0.0.1])
by mail.cs.ucla.edu (Postfix) with ESMTP id CB6273C010860;
Sun, 27 Jul 2025 17:26:25 -0700 (PDT)
Received: from mail.cs.ucla.edu ([127.0.0.1])
by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP
id w8JwYkN4PpQf; Sun, 27 Jul 2025 17:26:25 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
by mail.cs.ucla.edu (Postfix) with ESMTP id 9F00F3C010873;
Sun, 27 Jul 2025 17:26:25 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 9F00F3C010873
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1753662385;
bh=BKxDmmyFL0IN4zKkJIjRnp0xQySlpbNZm2cco/n38pk=;
h=Message-ID:Date:MIME-Version:From:To;
b=f//iMKvbq9VKhKGPjNuOvdDSS19dXpyrj0uyBytxzfQf572KqeUEh6VHwdXjF9Wru
Hea1AGieYqhgWFOIM5pMGZ6WiqGIQiddqH2d8SHTFOCavcwZcYfgMHR2SnZs1qroYw
dLSxkLOPJuVylhs0O651uxReIHHPOk2HeJxm6YKafTT8AF/T8wWl9cezOPjHgQAZXx
WgfWlSTK3JphEb2Z1L+xvUXzvWHg6J7U44O9fhep9vfCVgQQRs2xvamcB+sngL4jTZ
VQ4W87rax/jJgBDlGG2XPlnXqQKRnODZyEaXFnZd64ZYOaIe43q/wNxsJPr1mVkoPL
/DRihlAeRhrxg==
X-Virus-Scanned: amavis at mail.cs.ucla.edu
Received: from mail.cs.ucla.edu ([127.0.0.1])
by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP
id 20ppdQvP89_5; Sun, 27 Jul 2025 17:26:25 -0700 (PDT)
Received: from penguin.cs.ucla.edu
(47-154-30-222.fdr01.snmn.ca.ip.frontiernet.net [47.154.30.222])
by mail.cs.ucla.edu (Postfix) with ESMTPSA id 77AB33C010860;
Sun, 27 Jul 2025 17:26:25 -0700 (PDT)
Message-ID: <66d53976-bfa4-4e01-b354-757227dd5ff0@HIDDEN>
Date: Sun, 27 Jul 2025 17:26:24 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#47243: pr lacks -p
From: Paul Eggert <eggert@HIDDEN>
To: Collin Funk <collin.funk1@HIDDEN>, =?UTF-8?Q?P=C3=A1draig_Brady?=
<P@HIDDEN>
References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN>
<87y0s98dmn.fsf@HIDDEN>
<3f06b63f-e96b-4b31-bbf6-7edf446b69ae@HIDDEN>
<8734ah8atg.fsf@HIDDEN> <87tt2x6w59.fsf@HIDDEN>
<da614b77-81b5-449c-97b2-2e6291bff085@HIDDEN>
Content-Language: en-US
Organization: UCLA Computer Science Department
In-Reply-To: <da614b77-81b5-449c-97b2-2e6291bff085@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 47243
Cc: 47243 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
On 2025-07-27 17:19, Paul Eggert wrote:
> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 putc ('\a', std=
err);
A few more things.
stderr might be line buffered, so this needs an fflush afterwards.
If the putc or fflush fails, pr should diagnose and exit immediately=20
(otherwise the user will wonder why pr stopped).
A failed open or read from /dev/tty should be diagnosed and exited too.
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.
Received: (at 47243) by debbugs.gnu.org; 28 Jul 2025 00:19:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 27 20:19:35 2025
Received: from localhost ([127.0.0.1]:52562 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1ugBaY-0005us-UO
for submit <at> debbugs.gnu.org; Sun, 27 Jul 2025 20:19:35 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66]:55690)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eggert@HIDDEN>)
id 1ugBaR-0005uJ-9t
for 47243 <at> debbugs.gnu.org; Sun, 27 Jul 2025 20:19:32 -0400
Received: from localhost (localhost [127.0.0.1])
by mail.cs.ucla.edu (Postfix) with ESMTP id 9F7273C010860;
Sun, 27 Jul 2025 17:19:20 -0700 (PDT)
Received: from mail.cs.ucla.edu ([127.0.0.1])
by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP
id JeZX_1f96T6w; Sun, 27 Jul 2025 17:19:20 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
by mail.cs.ucla.edu (Postfix) with ESMTP id 7798F3C010873;
Sun, 27 Jul 2025 17:19:20 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 7798F3C010873
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1753661960;
bh=W1358Rnp06DCTEMbvVeLlOilohiU5Wvayl7eY0FTrT8=;
h=Message-ID:Date:MIME-Version:To:From;
b=NJ1MoWGpbEY1WRlLsA6C78lZlyUUCrxp4UUqMVo18pUL4CF5DGxZuqeRhvvTJ8r4t
i/23v2T423GvQUTZ26zW8QyLFWh7z6E4G3M5sYXLVUsb9MO3SQk3hLzX1hyYDFxcOT
h2cM2HEy2nHisdTdliTf1CZ5908BdCdDlBw33+9lL6lRW5Z/iGSJMDHa6/G5KZ4RXh
spouy0dvN9RsoWYAJieoS38VBfk6BK3M5I/HnYJUsh6gLgaA0KxMfAxU3+noGZYzka
6kBvMOFF7DC11Z4qGsVjGFj2Gl1ExvnmfwrBOdSI+KaxtmEBHtS2M3jNiHSEPhPwIP
rWhtDyg7DkYvg==
X-Virus-Scanned: amavis at mail.cs.ucla.edu
Received: from mail.cs.ucla.edu ([127.0.0.1])
by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP
id 4Y-l0sIHFJEA; Sun, 27 Jul 2025 17:19:20 -0700 (PDT)
Received: from penguin.cs.ucla.edu
(47-154-30-222.fdr01.snmn.ca.ip.frontiernet.net [47.154.30.222])
by mail.cs.ucla.edu (Postfix) with ESMTPSA id 4C11D3C010860;
Sun, 27 Jul 2025 17:19:20 -0700 (PDT)
Message-ID: <da614b77-81b5-449c-97b2-2e6291bff085@HIDDEN>
Date: Sun, 27 Jul 2025 17:19:18 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#47243: pr lacks -p
To: Collin Funk <collin.funk1@HIDDEN>, =?UTF-8?Q?P=C3=A1draig_Brady?=
<P@HIDDEN>
References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN>
<87y0s98dmn.fsf@HIDDEN>
<3f06b63f-e96b-4b31-bbf6-7edf446b69ae@HIDDEN>
<8734ah8atg.fsf@HIDDEN> <87tt2x6w59.fsf@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <87tt2x6w59.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 47243
Cc: 47243 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
Thanks for looking into that. Unfortunately POSIX says -p should be
ignored only if standard output is a terminal, and that newline should
be read from /dev/tty, not from standard input. This is so that users
can pipe into 'pr -p'. So the proposed patch needs some changes. Here
are the issues I found:
> + pr now supports the -p option, to pause upon printing each page until
> + a newline character is read from standard input, as required by POSIX
> + Issue 6. The corresponding long option is --pause.
This should be /dev/tty, not standard input.
> +After printing each page, print an alert (bell) to standard error and
> +wait for a newline to be read from standard input before printing the
Likewise.
> +next page. This option is ignored unless both standard input and
> +standard output are a tty.
This should mention only standard output.
> + if (pause_option)
> + pause_option = isatty (STDOUT_FILENO) && isatty (STDIN_FILENO);
This should check only standard output.
> - if (have_read_stdin && fclose (stdin) == EOF)
> + if ((have_read_stdin || pause_option) && fclose (stdin) == EOF)
> error (EXIT_FAILURE, errno, _("standard input"));
This change should be omitted.
> - while (print_page ())
> - ;
> + for (;;)
> + {
> + if (pause_option)
> + {
> + putc ('\a', stderr);
> + while (getchar () != '\n')
> + ;
> + }
> + if (! print_page ())
> + break;
> + }
This should read from /dev/tty, not from stdin.
> + -p, --pause pause at the beginning of each page until a newline\n\
> + is read from standard input.\n\
This should mention /dev/tty, not standard input.
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.
Received: (at 47243) by debbugs.gnu.org; 27 Jul 2025 23:39:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 27 19:39:59 2025
Received: from localhost ([127.0.0.1]:52489 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1ugAyE-0003S5-WE
for submit <at> debbugs.gnu.org; Sun, 27 Jul 2025 19:39:59 -0400
Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:59757)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <collin.funk1@HIDDEN>)
id 1ugAyA-0003Rk-Ix
for 47243 <at> debbugs.gnu.org; Sun, 27 Jul 2025 19:39:55 -0400
Received: by mail-pf1-x431.google.com with SMTP id
d2e1a72fcca58-747e41d5469so4124920b3a.3
for <47243 <at> debbugs.gnu.org>; Sun, 27 Jul 2025 16:39:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1753659588; x=1754264388; darn=debbugs.gnu.org;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=uqISHJlbvdNSX1UmF89Nhw/by01UD+VwThNpXLp2UjU=;
b=J23xhXjap/aUwu31shCr1cV4v03A7ZiVYEbS+hWHC5kVmPxrloz+OkuHjDJb028CxN
ecSbvZsIwppd5/4ggoLEjSF2lhGHkbyZbtX/ORIteLDryFDsUK/spyr8vUHgowD6s/IT
6OuxyObdeMSatAqQCtNxa+maTyGA1XYlH3tOwj5/PzX9JwIGXLXA8roQ+OO3vskZWRya
mgqk0zZwCRHv1UCOhR1341EjuI2WfW/qjevCh2hjyjBHLNN9+uOIuuFBhA65dtnuEyby
AIhLb5NIotiMCPlWf2pKXiRSYGWox8pLphYhT7tc2HyU47xE7jrJGHoXvBuOrpQuzzsY
LwXA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1753659588; x=1754264388;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=uqISHJlbvdNSX1UmF89Nhw/by01UD+VwThNpXLp2UjU=;
b=kwP7P2IU5hsZG8dpWc8ulTHWkXWDdmBFNzIquizDRU6854m5fR4yoqIv4osBi6VM1Y
V8Nxtyc4NSGZRN3ffFA9FGUNOso2ykPp9wj2WhwaZ+jMND9Lat8dngrRINI6HN+2puNF
X4P2KJ/oEOy/efs5gTEy2r+W8OHCy2PCQqvpWotuuO5tU7AxjE3RpNSfLY6X2KC7xtOt
6JOm01Q2U9zhawnnBroiIqaFsCxNXXa3PkNS0exx9+3QJOGxiQQ4/Fs4xN9mhMXQtJdh
oycVK18grn0U5APshKlUTLZ9ZqMUFJ1LDLgSD7sDCHlJfXlavFw07c/kCkEvU7KTFvTp
jbVg==
X-Gm-Message-State: AOJu0YxKgZ5jpKli3UykRC02FX0QCL3VhznQ1li/n8d45TgxHPyBmPqw
yLmHYguBCuhWfeU1RoMoIxZ+kSiEebztYUnQXM4idC5vDYHARIbVAyTcAjcvHw==
X-Gm-Gg: ASbGncvvNjhxzC6tTi3Nq8NWyg2xocYXvbCkn7n3T1c3b/UaY+gFoxJ4ZcS+XZ0ZE5k
OXoDfmzVnm/BFwuEU8BPuClxKS+9etwyhQO6wbBLwKehJpZji0MXXsTGQhiGie9sLbxaRpzdfBK
8W5oAxJKruAzqNfJUmI5tdwR47Y/LhhkJ7LRVxxTrzz0Qk7B4wwx37XZdmlfIzGNHgz+N3BrUFQ
VWE5MGCdYUfXr96v0fjqSPyBLGLGoDSQ0EPkpMWoFuozVTQCYWuruAh5+zALfVqOiEtnsIvrHjG
RqtRuBoBvRzUlpFRdozaIUneGVF7CcQZqFfnOU388ayuYcZNIJOoEADFEm5qWTmbmCQ+vumiQo0
p/T0=
X-Google-Smtp-Source: AGHT+IHik3gWAsQq58/RFSaanZQMoe/kNfurPBGwh2SfYCcoAozFW4p3ld3QlkDjqKPvuNr22D64Gw==
X-Received: by 2002:a05:6a00:8cb:b0:740:5927:bb8b with SMTP id
d2e1a72fcca58-7633322c898mr13964521b3a.0.1753659587763;
Sun, 27 Jul 2025 16:39:47 -0700 (PDT)
Received: from fedora ([2601:646:8081:3770::e9a2])
by smtp.gmail.com with ESMTPSA id
d2e1a72fcca58-764090e178bsm4090295b3a.62.2025.07.27.16.39.46
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sun, 27 Jul 2025 16:39:47 -0700 (PDT)
From: Collin Funk <collin.funk1@HIDDEN>
To: =?utf-8?Q?P=C3=A1draig?= Brady <P@HIDDEN>
Subject: Re: bug#47243: pr lacks -p
In-Reply-To: <8734ah8atg.fsf@HIDDEN>
References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN>
<87y0s98dmn.fsf@HIDDEN>
<3f06b63f-e96b-4b31-bbf6-7edf446b69ae@HIDDEN>
<8734ah8atg.fsf@HIDDEN>
Date: Sun, 27 Jul 2025 16:39:46 -0700
Message-ID: <87tt2x6w59.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 47243
Cc: 47243 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)
--=-=-=
Content-Type: text/plain
Collin Funk <collin.funk1@HIDDEN> writes:
> I have attached the V2 patch [...]
Oops, forgotten patch attached here.
Collin
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
filename=v2-0001-pr-implement-p-as-required-by-POSIX-Issue-6.patch
From 6927ed786c87d0849f70e20459672fcff0d114bd Mon Sep 17 00:00:00 2001
Message-ID: <6927ed786c87d0849f70e20459672fcff0d114bd.1753659226.git.collin.funk1@HIDDEN>
From: Collin Funk <collin.funk1@HIDDEN>
Date: Sun, 27 Jul 2025 15:00:15 -0700
Subject: [PATCH v2] pr: implement '-p' as required by POSIX Issue 6
* src/pr.c (pause_option): New variable.
(short_options): Add '-p'.
(long_options): Add '--pause'.
(main): Add the option. Ignore it if stdin or stdout are not a tty.
(print_files): If the option is use emit '\a' to stderr and wait until a
newline is read to print the next page.
(usage): Mention the new option.
* doc/coreutils.texi (pr invocation): Document the new option.
* NEWS: Mention the new option.
---
NEWS | 4 ++++
doc/coreutils.texi | 9 +++++++++
src/pr.c | 29 +++++++++++++++++++++++++----
3 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/NEWS b/NEWS
index 0b2be7116..3d0ee4b79 100644
--- a/NEWS
+++ b/NEWS
@@ -64,6 +64,10 @@ GNU coreutils NEWS -*- outline -*-
Iranian locale (fa_IR) and for the Ethiopian locale (am_ET), and also
does so more consistently for the Thailand locale (th_TH.UTF-8).
+ pr now supports the -p option, to pause upon printing each page until
+ a newline character is read from standard input, as required by POSIX
+ Issue 6. The corresponding long option is --pause.
+
* Noteworthy changes in release 9.7 (2025-04-09) [stable]
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 7ca5b222c..0aa767ba7 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -2825,6 +2825,15 @@ @node pr invocation
set with the @option{-W/-w} option. A limited overflow may occur with
numbered single column output (compare @option{-n} option).
+@item -p
+@itemx --pause
+@opindex -p
+@opindex --pause
+After printing each page, print an alert (bell) to standard error and
+wait for a newline to be read from standard input before printing the
+next page. This option is ignored unless both standard input and
+standard output are a tty.
+
@item -r
@itemx --no-file-warnings
@opindex -r
diff --git a/src/pr.c b/src/pr.c
index e7081a059..10c3af276 100644
--- a/src/pr.c
+++ b/src/pr.c
@@ -711,6 +711,9 @@ static char *custom_header;
/* (-D) Date format for the header. */
static char const *date_format;
+/* If true, pause after each page until a newline is read from stdin. */
+static bool pause_option;
+
/* The local time zone rules, as per the TZ environment variable. */
static timezone_t localtz;
@@ -738,7 +741,7 @@ enum
};
static char const short_options[] =
- "-0123456789D:FJN:S::TW:abcde::fh:i::l:mn::o:rs::tvw:";
+ "-0123456789D:FJN:S::TW:abcde::fh:i::l:mn::po:rs::tvw:";
static struct option const long_options[] =
{
@@ -758,6 +761,7 @@ static struct option const long_options[] =
{"number-lines", optional_argument, nullptr, 'n'},
{"first-line-number", required_argument, nullptr, 'N'},
{"indent", required_argument, nullptr, 'o'},
+ {"pause", no_argument, nullptr, 'p'},
{"no-file-warnings", no_argument, nullptr, 'r'},
{"separator", optional_argument, nullptr, 's'},
{"sep-string", optional_argument, nullptr, 'S'},
@@ -999,6 +1003,9 @@ main (int argc, char **argv)
chars_per_margin = getoptnum (optarg, 0,
_("'-o MARGIN' invalid line offset"));
break;
+ case 'p':
+ pause_option = true;
+ break;
case 'r':
ignore_failed_opens = true;
break;
@@ -1079,6 +1086,9 @@ main (int argc, char **argv)
error (EXIT_FAILURE, 0,
_("cannot specify both printing across and printing in parallel"));
+ if (pause_option)
+ pause_option = isatty (STDOUT_FILENO) && isatty (STDIN_FILENO);
+
/* Translate some old short options to new/long options.
To meet downward compatibility with other UNIX pr utilities
and some POSIX specifications. */
@@ -1147,7 +1157,7 @@ main (int argc, char **argv)
cleanup ();
- if (have_read_stdin && fclose (stdin) == EOF)
+ if ((have_read_stdin || pause_option) && fclose (stdin) == EOF)
error (EXIT_FAILURE, errno, _("standard input"));
main_exit (failed_opens ? EXIT_FAILURE : EXIT_SUCCESS);
}
@@ -1636,8 +1646,17 @@ print_files (int number_of_files, char **av)
init_funcs ();
line_number = line_count;
- while (print_page ())
- ;
+ for (;;)
+ {
+ if (pause_option)
+ {
+ putc ('\a', stderr);
+ while (getchar () != '\n')
+ ;
+ }
+ if (! print_page ())
+ break;
+ }
}
/* Initialize header information.
@@ -2824,6 +2843,8 @@ Paginate or columnate FILE(s) for printing.\n\
-o, --indent=MARGIN\n\
offset each line with MARGIN (zero) spaces, do not\n\
affect -w or -W, MARGIN will be added to PAGE_WIDTH\n\
+ -p, --pause pause at the beginning of each page until a newline\n\
+ is read from standard input.\n\
-r, --no-file-warnings\n\
omit warning when a file cannot be opened\n\
"), stdout);
--
2.50.1
--=-=-=--
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.Received: (at 47243) by debbugs.gnu.org; 27 Jul 2025 23:37:49 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 27 19:37:49 2025 Received: from localhost ([127.0.0.1]:52485 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ugAw8-0003Mx-H6 for submit <at> debbugs.gnu.org; Sun, 27 Jul 2025 19:37:49 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:53600) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <collin.funk1@HIDDEN>) id 1ugAvz-0003MJ-Rw for 47243 <at> debbugs.gnu.org; Sun, 27 Jul 2025 19:37:45 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-234c5b57557so31732415ad.3 for <47243 <at> debbugs.gnu.org>; Sun, 27 Jul 2025 16:37:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753659453; x=1754264253; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yVV9N6cwYm98LLFbPERaigwsCkixJkDEYiEgy/Z5zWQ=; b=LCFzkzRWxpaTtzzkvBWIoVhD+3AYmgNkpOByUwZKEqZpyHou+qWJLHNAesQYJRhrTJ riVpXETb8yqYGoGiaaY7bk27I/TUGw/+Rnt6uVHDZMAI5E01bj2yxhw0GnUM87nAFiBZ sLn8DWZYy9K98Z3YSLJalDncyXSwyg0vsaXOcrQjqd3/71/HOAe1Q2V37AU8SEv5di5O CB5agaAxV3QTjQEAiYhBtPvgyCCPhG7HltZxsWkiwO6SgXExaFQCYUz+3U6uiWRZf164 mBqDKRa4lDAWB4PbCWII3JkGYTRSzMoHrLiP032Zo6Okt9F1zPT0GLgwqBDKw46Kj4Fb 43gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753659453; x=1754264253; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=yVV9N6cwYm98LLFbPERaigwsCkixJkDEYiEgy/Z5zWQ=; b=MPpx6vMlQkAWhO/scKatvgJ8eFhG/gcE5IooZpSrOyeSazPVQ+DK9Xj+Lr1WOMVEaK v9gZsw4w+0FeMYoo1E9J5UdpW4lZuALr5cCKJWc32EmiShUGKBxLv1KkJdqDf+u28/b+ SoqAwHe40kehtDliPHMRputkHSFgOWx0vXSfVW+uf9gixKkVqLBLgFPY4cyvzu/kQ/Pv UNp6SOGs7wcRExHCbeLiVVeRTStaAJmSwTlhk+TdsKhs+4D4qKlhIydj1CBf3uj64nFE gzphSVCPAVgL+lHnhch5veeL6lJMWUWZUfvWMbuvEIpi4ybz6dx33ltLYLA6yNm1O87E Wc+w== X-Gm-Message-State: AOJu0YzGfkPdvgTE2a5uZIK3SSGGfxZmqAwpUbhQ3N3a6EwMc4RtblAI 0PiJ95HiqcTsoQnff4VXIzMewv5oAxOL1+HMZGPUYTdy08dEPf1/r8vTmPhvVQ== X-Gm-Gg: ASbGncs5M7E2uORtRw5rAIc4j7kdo3P5KzuyVJEW1/5n/VYmfpRassWo5WGh9SgAPw/ bjnqg7yZRVVoEY8jH6cg5DVQf+jtreSJcPMRdFt5Vmb/Jr5wiA2P7cw9DO9+MNbxcOYPLdFWNjy 7eRzI0taOO/7soHOMjVnScvwgL/5unvAVB6diTjwcs9s3R5SLRs29QIb3EeOT8nwogw/F+aHcs8 HUpY6f+RVAl41p2INlOeFaNg3sNTh4ndH+O12dQsWVXSCN7EZF1rvCYWfkOVoYUIJUFCkej2KdM tfNaMpfUQZapQEaC+/ZieO/F2gdhSOB57qE1vcTZnznMMI4nsj8xhMa9sfNSOh1zXDJjV3lQeFD LyeZGQMXZjmJqpA== X-Google-Smtp-Source: AGHT+IFnw+krkk7WxRdatrbkxzxhOT2h25DjsKCqEqMN801zfbQYdTK5kdqxhKmojo+1MUGfl/JoqA== X-Received: by 2002:a17:902:e748:b0:240:3915:99ba with SMTP id d9443c01a7336-24039159be4mr12737975ad.5.1753659453041; Sun, 27 Jul 2025 16:37:33 -0700 (PDT) Received: from fedora ([2601:646:8081:3770::e9a2]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-31e6635efb8sm8030890a91.19.2025.07.27.16.37.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Jul 2025 16:37:32 -0700 (PDT) From: Collin Funk <collin.funk1@HIDDEN> To: =?utf-8?Q?P=C3=A1draig?= Brady <P@HIDDEN> Subject: Re: bug#47243: pr lacks -p In-Reply-To: <3f06b63f-e96b-4b31-bbf6-7edf446b69ae@HIDDEN> References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN> <87y0s98dmn.fsf@HIDDEN> <3f06b63f-e96b-4b31-bbf6-7edf446b69ae@HIDDEN> Date: Sun, 27 Jul 2025 16:37:31 -0700 Message-ID: <8734ah8atg.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 47243 Cc: 47243 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.7 (/) Hi P=C3=A1draig, P=C3=A1draig Brady <P@HIDDEN> writes: >>> Given that hardly anybody uses pr any more, I'm surprised that the >>> Austin Group still cares about its options. It's an obsolete utility, >>> and ought to be deprecated. >> True, but this option seems simple enough to implement. >> How about the attached patch? > > I would just ignore the -p if stdin/stdout are not a tty. > That would make a test easier anyway, to ensure > `pr -p file >/dev/null` passes. Thanks for the input. I was conflicted on whether the best behavior was to warn, error, or ignore the option in those cases. And whether it should be ignored if standard out was not a tty. I guess it would be pointless to do, for example, 'pr -p ChangeLog < file-full-of-newlines'. I have attached the V2 patch which adds the additional check for 'isatty (STDIN_FILENO)' (V1 only had it for STDERR_FILENO), documents that behavior, and adds a NEWS entry. I'll push tomorrow to give others some time to comment. Collin
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.Received: (at 47243) by debbugs.gnu.org; 27 Jul 2025 23:09:53 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 27 19:09:53 2025 Received: from localhost ([127.0.0.1]:52423 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ugAV7-0001cU-EM for submit <at> debbugs.gnu.org; Sun, 27 Jul 2025 19:09:53 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:54700) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <pixelbeat@HIDDEN>) id 1ugAV4-0001c7-J1 for 47243 <at> debbugs.gnu.org; Sun, 27 Jul 2025 19:09:51 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-45611a6a706so17592535e9.1 for <47243 <at> debbugs.gnu.org>; Sun, 27 Jul 2025 16:09:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753657784; x=1754262584; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=efs9scyzqBtf9IxV/llFY68BEmRWbZBowBRDWg62nPk=; b=R9qDy3Ykver/3F/z4UL8uqHByk1JdIQmmCH/MpyVRFN42K0vmCL0snJBzHTz62IZf8 znOAKgGNGHCa8zW8+tsbbOwNklhNYdGId3FkiNJ22uNE2iitNOJSYm0lQlzsTPlknJti jAqGrNIPLrw3zLorNr5woMkVTYQEKnvvEFoaY4ZYFvl8w9EBx38LgYjL4c6lNVyqqXUb C25XoiENQSRsJxR8h8Wk3zdz2QJyGB2WOx50PMyT+jcrXFfOebiXdYJ0iouKbFR3WFuz LGP0aASajldb+6bs90h3GfIR8SOo6PYX+cRj1JypkcWAc6knsiUIxLFNRVtH010aAqHP NYFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753657784; x=1754262584; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=efs9scyzqBtf9IxV/llFY68BEmRWbZBowBRDWg62nPk=; b=fO8+9jxZVATfitdD4NM+UzMDKB4Xo1PBWEA//WhgCsFnRG0zqIlOOucNDwF5VtdNaJ 9DKdDtRFu/G6L9HeiYR2qFNlPTyHEGQ3w6nHYiFmOBlx2vyDS9ZLcADw12CnC8qTd6aQ pZE0G2gWNcwEAlEbPd6kT2sPQy0GhPPchaBpRL3N1ldqepTar9w193Zh1O/RI4DqrQc2 VZIi2IOeMjLnBP7lgOxusDqiXUMo9xZi5pOvsuQVETvd3sQ+k/E0Km4PZ8E9el3LB+c3 /LCEmMS2JCpK/p93mQccV2vYgGPdlZVePLndUm37gReAW9tUkkAjfBghnY4w1uB9wYVG N3Dw== X-Forwarded-Encrypted: i=1; AJvYcCXc7wY6fJGjwxU/HRC42k8hZ8VA0q+VGQfDUvbloEU9jH139jyVu+UuXNHncML+Dn9UPRsLjw==@debbugs.gnu.org X-Gm-Message-State: AOJu0YwCfUzU8PO/Isf06xMKSnvS/ag6XCgGHo2wBmWKKb3VB5yfRh0x DDldnJQUTQqWGfWKsCiEI5ZreNH3yAb7ipZ9NiLEcUiwGo+H1dlutPy1HrUibQ== X-Gm-Gg: ASbGncvX1eiFKTxg5IkMLB4TYD+YMBEg0L5zbytKND2HO3GCpOrvVxnkZIMuWvVa1Tw EH1BYBCnwAl+Ggioel0jKxHIdFwiEInvLJGzZI6T9jJjishv8ScKfwqI5oJKYvKVy1EG4q6NXCw li3FXt8YM/ArCZYfMPc/RZOllogJZUmTtj85ASfM6Uhh0oFBfsYcoddkUZeIpvnkgRBl19oTLv8 Vt+7BHqKspIPE81odWWfg0SIl5kK7OXK+88YoDNPrB6theziC3axwtQcmMV+iHYBl9OQGmdn3KA uKM1yyd8WKXpat2pryvW/xFj9P4Mu4wf9x2YrFB+4P73XwTCGjZBPc2r4PHEvr59yC/oRSmUZHq lzuk/U0FIgiBXtWPokUwU1yG+z1j+VPmmFgDXCrRXqDxPHdzXNuPUQChytXgDdCLvi1J11FIxul Ag5g== X-Google-Smtp-Source: AGHT+IECEFoO/hfzASVwxmuBkLsfxeRwp1IeqlNNQ16m6Hja/2TwH1tH/A+BQ3akeM8KmiJCnAp7aQ== X-Received: by 2002:a05:600c:1c94:b0:453:5a04:b60e with SMTP id 5b1f17b1804b1-4587911e679mr56093695e9.26.1753657784056; Sun, 27 Jul 2025 16:09:44 -0700 (PDT) Received: from [192.168.1.31] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4587ac7553dsm76563225e9.30.2025.07.27.16.09.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Jul 2025 16:09:43 -0700 (PDT) Message-ID: <3f06b63f-e96b-4b31-bbf6-7edf446b69ae@HIDDEN> Date: Mon, 28 Jul 2025 00:09:41 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: bug#47243: pr lacks -p To: Collin Funk <collin.funk1@HIDDEN>, 47243 <at> debbugs.gnu.org References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN> <87y0s98dmn.fsf@HIDDEN> Content-Language: en-US From: =?UTF-8?Q?P=C3=A1draig_Brady?= <P@HIDDEN> In-Reply-To: <87y0s98dmn.fsf@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 47243 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On 27/07/2025 23:36, Collin Funk wrote: > Paul Eggert said: > >> Given that hardly anybody uses pr any more, I'm surprised that the >> Austin Group still cares about its options. It's an obsolete utility, >> and ought to be deprecated. > > True, but this option seems simple enough to implement. > > How about the attached patch? I would just ignore the -p if stdin/stdout are not a tty. That would make a test easier anyway, to ensure `pr -p file >/dev/null` passes. thanks! Padraig
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.
Received: (at 47243) by debbugs.gnu.org; 27 Jul 2025 22:37:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 27 18:37:00 2025
Received: from localhost ([127.0.0.1]:52330 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1ug9zI-00082q-4u
for submit <at> debbugs.gnu.org; Sun, 27 Jul 2025 18:37:00 -0400
Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:61827)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <collin.funk1@HIDDEN>)
id 1ug9zF-00082W-NS
for 47243 <at> debbugs.gnu.org; Sun, 27 Jul 2025 18:36:58 -0400
Received: by mail-pf1-x42f.google.com with SMTP id
d2e1a72fcca58-75bd436d970so2318725b3a.3
for <47243 <at> debbugs.gnu.org>; Sun, 27 Jul 2025 15:36:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1753655811; x=1754260611; darn=debbugs.gnu.org;
h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc
:subject:date:message-id:reply-to;
bh=77vbYHxpK9NDkvx5KkhBURI+H6T2ybUwTRjt8tWQTWo=;
b=i+a2Wfx2CSDumHNE3c3vl0UAPRkSbJsMG7BIw2CULf3Jq/s/ZXddnIs80WERUp5Hl6
Wva1XP7r6xiBndXbV+ObvxZfwnvzMMrQuP8E3FZqnXWk1U3j2q/LYng5NCWSiCxZIhl5
nNtTadOSWcPZzzvNEvx87GV+pcUSvq6bIqKAmh7/OvoL/RaQAABLVqA0CMJ+Z06Jkyal
x5dwGDARFFQaHgjHo1NawkgdAZLRHT1yf9Wl9es9LFdS00Hin8bphE2hRcHMQPS7QNB8
sIBNN/SRpvz0MVivZiWfqNOve2+ZFCvXon2b8XNeqSzPcOvNdEvQaJvlQIzDqDTt5Imh
zb7A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1753655811; x=1754260611;
h=mime-version:user-agent:message-id:date:subject:to:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=77vbYHxpK9NDkvx5KkhBURI+H6T2ybUwTRjt8tWQTWo=;
b=BCP5UwZyfnorNw27uSrgqDKH+m66R2GJ+dtULseQCvGqvEjnfTr6jUbaSnIGpYQYTS
kCe8OCFCfXKQAoWcdVeUjWLQ5Elm1/axeOJO1urV+mtgKzlu4BMUXtYBJT4JIeKlpqhL
DFyz+TM1q8C0ysubHgSxuIzhoaiG5A381OTL2d/l5GNJFIkWn7d04cIcbMXJ6Y4tjDJZ
XQK8/d3r6Qsd9yadfWV/xhw025hJCfkKKyn8ahHRP5VtCOFZbcNqgo0fW/JaPRewadgi
qDFCRhbfGExbP+jtj6Kz3VHdprsxXJnYlACeyv/PoEDArYKCFAAX8VasIrix7xTkQuov
G1aQ==
X-Gm-Message-State: AOJu0YzqRQkZwqigIfrOK0q0v50T2LlsIh4vYCr60y/5t5BSKARZF5vw
vMn0ArTZMC2jh/OIOL59uC3IIp7ig4VHiG7QlDboqgBILFQ/LUBFWIQ55ZRs3Q==
X-Gm-Gg: ASbGncvkM+OigFv7eovWgmYMdJZuTKKzCcf37/ITv1H8QfVctv/Rfl2KyI74is5NwBN
9YtOuevd3JsB/b2SL+MT3KH7xyDtV9w7JCoze0FKX2xqPFkay/LYBJifHerRV9A4l7Pf2H/iky0
XQdvXod6IoqEn5cOMzQf4mnpoOnMrlDFi9IgV4C36J3nbik6Lq+kYtxsHkZnqPhIcBEPf54kRsT
ClFzrRLdHJh2IQsFC5KxFhYR9gCQq23mHBZCokMp5GQTttw6GNMHu3iXGHt957NvxUnKhEhKizz
bc/1TtvpWf0UN1gWnS14wWe02PRmldNsvUsPiKJJWH98Z/figtKHVdbHnG+e8szwkykt8smX8uK
T6fV9BFYOi8nXkA==
X-Google-Smtp-Source: AGHT+IEDovoUELCXgt+HIH6vHTf1eXeZu1HMjQwb5lx0nt3I13BUyOkSAeHCKZjykchXnjPAQIWnqw==
X-Received: by 2002:a05:6a00:1384:b0:740:6f69:f52a with SMTP id
d2e1a72fcca58-7632f4fecc5mr13678416b3a.0.1753655810738;
Sun, 27 Jul 2025 15:36:50 -0700 (PDT)
Received: from fedora ([2601:646:8081:3770::e9a2])
by smtp.gmail.com with ESMTPSA id
d2e1a72fcca58-7640b8b0c6bsm4064258b3a.123.2025.07.27.15.36.49
for <47243 <at> debbugs.gnu.org>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sun, 27 Jul 2025 15:36:50 -0700 (PDT)
From: Collin Funk <collin.funk1@HIDDEN>
To: 47243 <at> debbugs.gnu.org
Subject: Re: pr lacks -p
Date: Sun, 27 Jul 2025 15:36:48 -0700
Message-ID: <87y0s98dmn.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 47243
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)
--=-=-=
Content-Type: text/plain
Paul Eggert said:
> Given that hardly anybody uses pr any more, I'm surprised that the
> Austin Group still cares about its options. It's an obsolete utility,
> and ought to be deprecated.
True, but this option seems simple enough to implement.
How about the attached patch?
Collin
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
filename=0001-pr-implement-p-as-required-by-POSIX-Issue-6.patch
From 5b4ac990e8dd43d8f3e1371e2e78271c9b35345e Mon Sep 17 00:00:00 2001
Message-ID: <5b4ac990e8dd43d8f3e1371e2e78271c9b35345e.1753655792.git.collin.funk1@HIDDEN>
From: Collin Funk <collin.funk1@HIDDEN>
Date: Sun, 27 Jul 2025 15:00:15 -0700
Subject: [PATCH] pr: implement '-p' as required by POSIX Issue 6
* src/pr.c (pause_option): New variable.
(short_options): Add '-p'.
(long_options): Add '--pause'.
(main): Add the option. Only allow its use when stdout is a tty.
(print_files): If the option is use emit '\a' to stderr and wait until a
newline is read to print the next page.
(usage): Mention the new option.
* doc/coreutils.texi (pr invocation): Document the new option.
---
doc/coreutils.texi | 8 ++++++++
src/pr.c | 30 ++++++++++++++++++++++++++----
2 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 7ca5b222c..14b98ea01 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -2825,6 +2825,14 @@ @node pr invocation
set with the @option{-W/-w} option. A limited overflow may occur with
numbered single column output (compare @option{-n} option).
+@item -p
+@itemx --pause
+@opindex -p
+@opindex --pause
+After printing each page, print an alert (bell) to standard error and
+wait for a newline to be read from standard input before printing the
+next page.
+
@item -r
@itemx --no-file-warnings
@opindex -r
diff --git a/src/pr.c b/src/pr.c
index e7081a059..5ccc7bf8a 100644
--- a/src/pr.c
+++ b/src/pr.c
@@ -711,6 +711,9 @@ static char *custom_header;
/* (-D) Date format for the header. */
static char const *date_format;
+/* If true, pause after each page until a newline is read from stdin. */
+static bool pause_option;
+
/* The local time zone rules, as per the TZ environment variable. */
static timezone_t localtz;
@@ -738,7 +741,7 @@ enum
};
static char const short_options[] =
- "-0123456789D:FJN:S::TW:abcde::fh:i::l:mn::o:rs::tvw:";
+ "-0123456789D:FJN:S::TW:abcde::fh:i::l:mn::po:rs::tvw:";
static struct option const long_options[] =
{
@@ -758,6 +761,7 @@ static struct option const long_options[] =
{"number-lines", optional_argument, nullptr, 'n'},
{"first-line-number", required_argument, nullptr, 'N'},
{"indent", required_argument, nullptr, 'o'},
+ {"pause", no_argument, nullptr, 'p'},
{"no-file-warnings", no_argument, nullptr, 'r'},
{"separator", optional_argument, nullptr, 's'},
{"sep-string", optional_argument, nullptr, 'S'},
@@ -999,6 +1003,9 @@ main (int argc, char **argv)
chars_per_margin = getoptnum (optarg, 0,
_("'-o MARGIN' invalid line offset"));
break;
+ case 'p':
+ pause_option = true;
+ break;
case 'r':
ignore_failed_opens = true;
break;
@@ -1079,6 +1086,10 @@ main (int argc, char **argv)
error (EXIT_FAILURE, 0,
_("cannot specify both printing across and printing in parallel"));
+ if (pause_option && ! isatty (STDOUT_FILENO))
+ error (EXIT_FAILURE, 0,
+ _("cannot use --pause (-p) unless writing and reading from a tty"));
+
/* Translate some old short options to new/long options.
To meet downward compatibility with other UNIX pr utilities
and some POSIX specifications. */
@@ -1147,7 +1158,7 @@ main (int argc, char **argv)
cleanup ();
- if (have_read_stdin && fclose (stdin) == EOF)
+ if ((have_read_stdin || pause_option) && fclose (stdin) == EOF)
error (EXIT_FAILURE, errno, _("standard input"));
main_exit (failed_opens ? EXIT_FAILURE : EXIT_SUCCESS);
}
@@ -1636,8 +1647,17 @@ print_files (int number_of_files, char **av)
init_funcs ();
line_number = line_count;
- while (print_page ())
- ;
+ for (;;)
+ {
+ if (pause_option)
+ {
+ putc ('\a', stderr);
+ while (getchar () != '\n')
+ ;
+ }
+ if (! print_page ())
+ break;
+ }
}
/* Initialize header information.
@@ -2824,6 +2844,8 @@ Paginate or columnate FILE(s) for printing.\n\
-o, --indent=MARGIN\n\
offset each line with MARGIN (zero) spaces, do not\n\
affect -w or -W, MARGIN will be added to PAGE_WIDTH\n\
+ -p, --pause pause at the beginning of each page until a newline\n\
+ is read from standard input.\n\
-r, --no-file-warnings\n\
omit warning when a file cannot be opened\n\
"), stdout);
--
2.50.1
--=-=-=--
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.Paul Eggert <eggert@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.Received: (at 47243) by debbugs.gnu.org; 18 Mar 2021 17:51:50 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 18 13:51:50 2021 Received: from localhost ([127.0.0.1]:47972 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1lMwoI-0006lb-40 for submit <at> debbugs.gnu.org; Thu, 18 Mar 2021 13:51:50 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:57100) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eggert@HIDDEN>) id 1lMwoE-0006lE-W7 for 47243 <at> debbugs.gnu.org; Thu, 18 Mar 2021 13:51:48 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id EE3D916014C; Thu, 18 Mar 2021 10:51:40 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 47KnLV1JZZc5; Thu, 18 Mar 2021 10:51:40 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 16519160133; Thu, 18 Mar 2021 10:51:40 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id GJy8tO9P6S5T; Thu, 18 Mar 2021 10:51:40 -0700 (PDT) Received: from [192.168.1.9] (cpe-23-243-218-95.socal.res.rr.com [23.243.218.95]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id C6CB216012A; Thu, 18 Mar 2021 10:51:39 -0700 (PDT) Subject: Re: bug#47243: pr lacks -p To: Eric Blake <eblake@HIDDEN> References: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN> From: Paul Eggert <eggert@HIDDEN> Organization: UCLA Computer Science Department Message-ID: <5fa22023-5f76-d87b-586b-f4fbe91c6dc0@HIDDEN> Date: Thu, 18 Mar 2021 10:51:38 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 47243 Cc: 47243 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) On 3/18/21 8:38 AM, Eric Blake wrote: > POSIX requires 'pr -p' to support paging (although it incorrectly stated > that it waits for \r, and is being fixed to wait for \n instead): > https://austingroupbugs.net/view.php?id=1433 > > During discussion of the behavior of -p today, the Austin Group was > surprised that coreutils' pr lacks -p altogether. Given that hardly anybody uses pr any more, I'm surprised that the Austin Group still cares about its options. It's an obsolete utility, and ought to be deprecated.
bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.Received: (at submit) by debbugs.gnu.org; 18 Mar 2021 15:38:58 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 18 11:38:58 2021 Received: from localhost ([127.0.0.1]:47766 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1lMuji-0001Ff-8b for submit <at> debbugs.gnu.org; Thu, 18 Mar 2021 11:38:58 -0400 Received: from lists.gnu.org ([209.51.188.17]:50038) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eblake@HIDDEN>) id 1lMujd-0001FV-PF for submit <at> debbugs.gnu.org; Thu, 18 Mar 2021 11:38:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eblake@HIDDEN>) id 1lMujd-0004S5-Gh for bug-coreutils@HIDDEN; Thu, 18 Mar 2021 11:38:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:26737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eblake@HIDDEN>) id 1lMujb-0004JK-UP for bug-coreutils@HIDDEN; Thu, 18 Mar 2021 11:38:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616081930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ijc4zSU4irVKgqDPHQFFqXa6I9GB6coJZJCVmEjLFZE=; b=YV8GlEA8fVpcDbVE5w+jtKMuipB/L9S0Pl9VPnqjWbckLnCuRB95LqcnqHT8B8mttKEBSG m3qpPNNAOV7g1ubWTXxR0bA4+F0SruT82bYSSnha4EStQ7gBiB4cqNCpKkMewlFfwuQlnQ 0Kz4kCGFbYs0Nw44Gj8FDo0WYTbf9/w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-287-IZXSyoYcOhaQJe5plunPUA-1; Thu, 18 Mar 2021 11:38:47 -0400 X-MC-Unique: IZXSyoYcOhaQJe5plunPUA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E950784BA42 for <bug-coreutils@HIDDEN>; Thu, 18 Mar 2021 15:38:46 +0000 (UTC) Received: from [10.3.113.66] (ovpn-113-66.phx2.redhat.com [10.3.113.66]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C482A60C03 for <bug-coreutils@HIDDEN>; Thu, 18 Mar 2021 15:38:45 +0000 (UTC) To: Coreutils <bug-coreutils@HIDDEN> From: Eric Blake <eblake@HIDDEN> Subject: pr lacks -p Organization: Red Hat, Inc. Message-ID: <8639f2c8-3d28-47ba-f879-b4594397a715@HIDDEN> Date: Thu, 18 Mar 2021 10:38:44 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eblake@HIDDEN X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=216.205.24.124; envelope-from=eblake@HIDDEN; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.249, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.4 (--) POSIX requires 'pr -p' to support paging (although it incorrectly stated that it waits for \r, and is being fixed to wait for \n instead): https://austingroupbugs.net/view.php?id=1433 During discussion of the behavior of -p today, the Austin Group was surprised that coreutils' pr lacks -p altogether. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Eric Blake <eblake@HIDDEN>:bug-coreutils@HIDDEN.
Full text available.bug-coreutils@HIDDEN:bug#47243; Package coreutils.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.