From unknown Sun Aug 17 23:32:29 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#9347 <9347@debbugs.gnu.org> To: bug#9347 <9347@debbugs.gnu.org> Subject: Status: PR(1) -t/-T negates :STOP_PAGE Reply-To: bug#9347 <9347@debbugs.gnu.org> Date: Mon, 18 Aug 2025 06:32:29 +0000 retitle 9347 PR(1) -t/-T negates :STOP_PAGE reassign 9347 coreutils submitter 9347 beaker@freeshell.org severity 9347 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 23 02:52:42 2011 Received: (at submit) by debbugs.gnu.org; 23 Aug 2011 06:52:43 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qvkqm-0005I2-Ia for submit@debbugs.gnu.org; Tue, 23 Aug 2011 02:52:41 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QvkVM-00045b-NN for submit@debbugs.gnu.org; Tue, 23 Aug 2011 02:30:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QvkT0-0004Zl-24 for submit@debbugs.gnu.org; Tue, 23 Aug 2011 02:28:06 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:52729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvkT0-0004Zh-0d for submit@debbugs.gnu.org; Tue, 23 Aug 2011 02:28:06 -0400 Received: from eggs.gnu.org ([140.186.70.92]:54850) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvkSz-0007mA-2U for bug-coreutils@gnu.org; Tue, 23 Aug 2011 02:28:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QvkSy-0004ZU-5A for bug-coreutils@gnu.org; Tue, 23 Aug 2011 02:28:05 -0400 Received: from mx.sdf.org ([192.94.73.19]:55309 helo=sdf.lonestar.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvkSx-0004ZN-R4 for bug-coreutils@gnu.org; Tue, 23 Aug 2011 02:28:04 -0400 Received: from sdf.org (jgw@sverige.freeshell.org [192.94.73.4]) by sdf.lonestar.org (8.14.4/8.14.3) with ESMTP id p7N5wHHW004677 for ; Tue, 23 Aug 2011 05:58:18 GMT Received: (from jgw@localhost) by sdf.org (8.14.4/8.12.8/Submit) id p7N5wHkA004066 for bug-coreutils@gnu.org; Mon, 22 Aug 2011 22:58:17 -0700 (EDT) Date: Mon, 22 Aug 2011 22:58:17 -0700 From: beaker@freeshell.org To: bug-coreutils@gnu.org Subject: PR(1) -t/-T negates :STOP_PAGE Message-ID: <4e534179.w7Xz8uQ50rD3XNhx%beaker@freeshell.org> User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: NetBSD 3.0 (DF) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 23 Aug 2011 02:52:39 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: beaker@freeshell.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) The issue: Running pr(1) with eith the -t or -T options appears to negate the --page option's :LAST_PAGE optional argument. The documentation does not mention this effect; either the documentation or the program should be updated to address this. Illustration of issue: $ wc -l foo 144 foo $ pr +1:1 foo | wc -l 66 $ pr +1:1 -t foo | wc -l 144 $ pr +1:1 -T foo | wc -l 144 Version and system info: $ pr --version | head -n1 pr (GNU coreutils) 7.4 $ uname -a Linux thinkcentre 2.6.32-33-generic #72-Ubuntu SMP Fri Jul 29 21:08:37 UTC 2011 i686 GNU/Linux From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 23 10:21:24 2011 Received: (at 9347) by debbugs.gnu.org; 23 Aug 2011 14:21:24 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qvrr2-0002LS-9E for submit@debbugs.gnu.org; Tue, 23 Aug 2011 10:21:24 -0400 Received: from mail3.vodafone.ie ([213.233.128.45]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qvrqz-0002LJ-Nk for 9347@debbugs.gnu.org; Tue, 23 Aug 2011 10:21:22 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnYCABC2U05tTGmk/2dsb2JhbAAMNZkOkUUBAQUyAUYQCw0LCRYPCQMCAQIBRRMBBQIBAcJvhkgEmESDEog+ Received: from unknown (HELO [192.168.1.79]) ([109.76.105.164]) by mail3.vodafone.ie with ESMTP; 23 Aug 2011 15:18:52 +0100 Message-ID: <4E53B6CC.5070208@draigBrady.com> Date: Tue, 23 Aug 2011 15:18:52 +0100 From: =?ISO-8859-1?Q?P=E1draig_Brady?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110707 Thunderbird/5.0 MIME-Version: 1.0 To: beaker@freeshell.org Subject: Re: bug#9347: PR(1) -t/-T negates :STOP_PAGE References: <4e534179.w7Xz8uQ50rD3XNhx%beaker@freeshell.org> In-Reply-To: <4e534179.w7Xz8uQ50rD3XNhx%beaker@freeshell.org> X-Enigmail-Version: 1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 9347 Cc: 9347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 08/23/2011 06:58 AM, beaker@freeshell.org wrote: > The issue: > Running pr(1) with eith the -t or -T options appears to negate the --page > option's :LAST_PAGE optional argument. The documentation does not mention > this effect; either the documentation or the program should be updated to > address this. > > Illustration of issue: > > $ wc -l foo > 144 foo > $ pr +1:1 foo | wc -l > 66 > $ pr +1:1 -t foo | wc -l > 144 > $ pr +1:1 -T foo | wc -l > 144 > > Version and system info: > > $ pr --version | head -n1 > pr (GNU coreutils) 7.4 > $ uname -a > Linux thinkcentre 2.6.32-33-generic #72-Ubuntu SMP Fri Jul 29 21:08:37 UTC 2011 i686 GNU/Linux This looks like a bug, since `pr +2 -T` does skip the first page. I.E. -tT should be independent of those page ranges. The following seems to work, and pass tests. cheers, Pádraig. diff --git a/src/pr.c b/src/pr.c index 771418c..d1adc55 100644 --- a/src/pr.c +++ b/src/pr.c @@ -1887,7 +1887,7 @@ print_page (void) print_a_FF = false; } - if (last_page_number < page_number) + if (last_page_number < ++page_number) return false; /* Stop printing with LAST_PAGE */ reset_status (); /* Change ON_HOLD to OPEN. */ @@ -2399,7 +2399,7 @@ print_header (void) /* The translator must ensure that formatting the translation of "Page %"PRIuMAX does not generate more than (sizeof page_text - 1) bytes. */ - sprintf (page_text, _("Page %"PRIuMAX), page_number++); + sprintf (page_text, _("Page %"PRIuMAX), page_number); available_width = header_width_available - mbswidth (page_text, 0); available_width = MAX (0, available_width); lhs_spaces = available_width >> 1; From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 23 19:30:11 2011 Received: (at 9347-done) by debbugs.gnu.org; 23 Aug 2011 23:30:11 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qw0Q6-0006br-6O for submit@debbugs.gnu.org; Tue, 23 Aug 2011 19:30:11 -0400 Received: from mail3.vodafone.ie ([213.233.128.45]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qw0Q2-0006Tu-SC for 9347-done@debbugs.gnu.org; Tue, 23 Aug 2011 19:30:08 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlECAME1VE5tTGmk/2dsb2JhbAAMNphbkUUBAQUyAUYQCw0LCSUPSBMBBQIBAcRjhkgEmESDEog+ Received: from unknown (HELO [192.168.1.79]) ([109.76.105.164]) by mail3.vodafone.ie with ESMTP; 24 Aug 2011 00:27:35 +0100 Message-ID: <4E543766.6@draigBrady.com> Date: Wed, 24 Aug 2011 00:27:34 +0100 From: =?ISO-8859-1?Q?P=E1draig_Brady?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110707 Thunderbird/5.0 MIME-Version: 1.0 To: beaker@freeshell.org Subject: Re: bug#9347: PR(1) -t/-T negates :STOP_PAGE References: <4e534179.w7Xz8uQ50rD3XNhx%beaker@freeshell.org> <4E53B6CC.5070208@draigBrady.com> In-Reply-To: <4E53B6CC.5070208@draigBrady.com> X-Enigmail-Version: 1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 9347-done Cc: 9347-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 08/23/2011 03:18 PM, Pádraig Brady wrote: > On 08/23/2011 06:58 AM, beaker@freeshell.org wrote: >> The issue: >> Running pr(1) with eith the -t or -T options appears to negate the --page >> option's :LAST_PAGE optional argument. The documentation does not mention >> this effect; either the documentation or the program should be updated to >> address this. >> >> Illustration of issue: >> >> $ wc -l foo >> 144 foo >> $ pr +1:1 foo | wc -l >> 66 >> $ pr +1:1 -t foo | wc -l >> 144 >> $ pr +1:1 -T foo | wc -l >> 144 >> >> Version and system info: >> >> $ pr --version | head -n1 >> pr (GNU coreutils) 7.4 >> $ uname -a >> Linux thinkcentre 2.6.32-33-generic #72-Ubuntu SMP Fri Jul 29 21:08:37 UTC 2011 i686 GNU/Linux > > This looks like a bug, since `pr +2 -T` does skip the first page. > I.E. -tT should be independent of those page ranges. > > The following seems to work, and pass tests. > cheers, > Pádraig. > > diff --git a/src/pr.c b/src/pr.c > index 771418c..d1adc55 100644 > --- a/src/pr.c > +++ b/src/pr.c > @@ -1887,7 +1887,7 @@ print_page (void) > print_a_FF = false; > } > > - if (last_page_number < page_number) > + if (last_page_number < ++page_number) > return false; /* Stop printing with LAST_PAGE */ > > reset_status (); /* Change ON_HOLD to OPEN. */ > @@ -2399,7 +2399,7 @@ print_header (void) > /* The translator must ensure that formatting the translation of > "Page %"PRIuMAX does not generate more than (sizeof page_text - 1) > bytes. */ > - sprintf (page_text, _("Page %"PRIuMAX), page_number++); > + sprintf (page_text, _("Page %"PRIuMAX), page_number); > available_width = header_width_available - mbswidth (page_text, 0); > available_width = MAX (0, available_width); > lhs_spaces = available_width >> 1; I applied the above with a test, so I'm closing this. cheers, Pádraig. From unknown Sun Aug 17 23:32:29 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 21 Sep 2011 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator