GNU bug report logs - #9347
PR(1) -t/-T negates :STOP_PAGE

Previous Next

Package: coreutils;

Reported by: beaker <at> freeshell.org

Date: Tue, 23 Aug 2011 06:53:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9347 in the body.
You can then email your comments to 9347 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#9347; Package coreutils. (Tue, 23 Aug 2011 06:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to beaker <at> freeshell.org:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Tue, 23 Aug 2011 06:53:03 GMT) Full text and rfc822 format available.

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

From: beaker <at> freeshell.org
To: bug-coreutils <at> gnu.org
Subject: PR(1) -t/-T negates :STOP_PAGE
Date: Mon, 22 Aug 2011 22:58:17 -0700
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




Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#9347; Package coreutils. (Tue, 23 Aug 2011 14:22:01 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: beaker <at> freeshell.org
Cc: 9347 <at> debbugs.gnu.org
Subject: Re: bug#9347: PR(1) -t/-T negates :STOP_PAGE
Date: Tue, 23 Aug 2011 15:18:52 +0100
On 08/23/2011 06:58 AM, beaker <at> 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;




Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Tue, 23 Aug 2011 23:31:02 GMT) Full text and rfc822 format available.

Notification sent to beaker <at> freeshell.org:
bug acknowledged by developer. (Tue, 23 Aug 2011 23:31:02 GMT) Full text and rfc822 format available.

Message #13 received at 9347-done <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: beaker <at> freeshell.org
Cc: 9347-done <at> debbugs.gnu.org
Subject: Re: bug#9347: PR(1) -t/-T negates :STOP_PAGE
Date: Wed, 24 Aug 2011 00:27:34 +0100
On 08/23/2011 03:18 PM, Pádraig Brady wrote:
> On 08/23/2011 06:58 AM, beaker <at> 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.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 21 Sep 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 333 days ago.

Previous Next


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