Subject: bug#9347: closed (Re: bug#9347: PR(1) -t/-T negates :STOP_PAGE)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 23 Aug 2011 23:31:02 +0000

Your bug report

#9347: PR(1) -t/-T negates :STOP_PAGE

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
9347: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9347
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#9347: PR(1) -t/-T negates :STOP_PAGE
From: Pádraig Brady <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Wed, 24 Aug 2011 00:27:34 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

On 08/23/2011 03:18 PM, Pádraig Brady wrote:
> On 08/23/2011 06:58 AM, [email-masked] 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.

Subject: PR(1) -t/-T negates :STOP_PAGE
From: [email-masked]
To: [email-masked]
Date: Mon, 22 Aug 2011 22:58:17 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

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