--- Begin Message ---
Subject: |
pr command does not honor -f or --form-feed option |
Date: |
Thu, 7 Jul 2011 17:45:01 -0500 |
I think that I have found a bug with the pr command
Version Info
pr 5.97 October 2008 PR(1)
root:address@hidden:/
# rpm -qa --filesbypkg | grep -w /usr/bin/pr
coreutils /usr/bin/pr
root:address@hidden:/
# rpm -q coreutils
coreutils-5.97-19.el5
test.txt is just a 66 line file with the numbers 1-66, one per line
pr -t -f -l33 -w80 test.txt > withf.txt
pr -t -l33 -w80 test.txt > withof.txt
diff withf.txt withof.txt
In AIX
address@hidden:/>
# pr -t -f -l33 -w80 test.txt > withf.txt
address@hidden:/>
# pr -t -l33 -w80 test.txt > withof.txt
address@hidden:/>
# diff withf.txt withof.txt
diff: 0653-827 Missing newline at the end of file withf.txt.
34c34
<
34
---
> 34
67d66
<
address@hidden:/>
# cat withf.txt | wc -c
191
address@hidden:/>
# cat withof.txt | wc -c
189
in LINUX
root:address@hidden:/
# pr -t -f -l33 -w80 test.txt > withf.txt
root:address@hidden:/
# pr -t -l33 -w80 test.txt > withof.txt
root:address@hidden:/
# diff withf.txt withof.txt
root:address@hidden:/
# cat withf.txt | wc -c
189
root:address@hidden:/
# cat withof.txt | wc -c
189
root:address@hidden:/
Paul W. Conklin | Sr Team Lead | Cerner Corporation | 816.201.7128 | Cell:
816.885.5691 | address@hidden | www.cerner.com
----------------------------------------------------------------------
CONFIDENTIALITY NOTICE This message and any included attachments are from
Cerner Corporation and are intended only for the addressee. The information
contained in this message is confidential and may constitute inside or
non-public information under international, federal, or state securities laws.
Unauthorized forwarding, printing, copying, distribution, or use of such
information is strictly prohibited and may be unlawful. If you are not the
addressee, please promptly delete this message and notify the sender of the
delivery error by e-mail or you may call Cerner's corporate offices in Kansas
City, Missouri, U.S.A at (+1) (816)221-1024.
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#9023: pr command does not honor -f or --form-feed option |
Date: |
Sun, 10 Jul 2011 12:51:34 +0200 |
Jim Meyering wrote:
> Jim Meyering wrote:
>> Conklin,Paul W. wrote:
>>> I think that I have found a bug with the pr command
>>>
>>> Version Info
>>> pr 5.97 October 2008
>>> PR(1)
>>
>> Thank you for the report.
>> I confirm that GNU pr (even the latest, from coreutils-8.12)
>> is not compatible with the pr from Solaris 10:
>>
>> solaris$ seq 9|/usr/bin/pr -t -f -l3|grep -c '^L'
>> 3
>> solaris$ seq 9|pr -t -f -l3|grep -c '^L'
>> 0
>>
>> The source of pr is the ugliest and least maintainable (by far) in coreutils,
>> but we have decent test coverage for it, so we should be able to fix this
>> soon.
>
> For the record, NetBSD 5.0.2's pr supports -F but not -f,
> and its -F behavior matches that of GNU pr:
>
> netbsd$ seq 9|/usr/bin/pr -t -F -l3|cat -A
> 1$
> 2$
> 3$
> 4$
> 5$
> 6$
> 7$
> 8$
> 9$
>
> However, on FreeBSD 8.2, OpenBSD 4.7, darwin 10.8 and SunOS 5.11
> the vendor pr behavior matches that of AIX and solaris-10.
Actually, consider the POSIX spec for pr.
Its description of the -t option says this:
-t Write neither the five-line identifying header nor the five-line
trailer usually supplied for each page. Quit writing after the
last line of each file without spacing to the end of the page.
Which I interpret as meaning pr should write neither those spaces
(the default trailer) nor the replacement formfeed that you get with -f.
So, unless we get an interpretation from the POSIX folks
that says otherwise, I'll leave GNU pr the way it is.
I've marked this issue as "done" for now, but you're welcome to reopen it.
--- End Message ---