GNU bug report logs -
#9347
PR(1) -t/-T negates :STOP_PAGE
Previous Next
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.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
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 9347 <at> debbugs.gnu.org.
--
9347: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9347
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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.
[Message part 3 (message/rfc822, inline)]
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 bug report was last modified 13 years and 335 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.