NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/60520: pax: -0 option applies only to input, not to output
>Number: 60520
>Category: bin
>Synopsis: pax: -0 option applies only to input, not to output
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jul 30 19:25:00 +0000 2026
>Originator: Taylor R Campbell
>Release: current, 11, 10, 9, ...
>Organization:
The PaxBSD Extension, Inc0
>Environment:
>Description:
Our pax(1) has an option `-0' to read files on input with a NUL
separator instead of LF separator:
-0 Use the nul character instead of \n as the file separator when
reading files from standard input.
https://man.netbsd.org/NetBSD-11.x-BRANCH/pax.1
However, it doesn't apply to files written on output.
This option for the POSIX committe-invented pax(1) interface is
an extension to POSIX:
https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/utilities/pax.html
Strikes me as weird to carve out bespoke extensions to the
POSIX pax(1) interface, but what `-0' does at least strikes me
as sensible -- except for the part where it only applies to
input, not to output.
>How-To-Repeat:
$ (cd / && pax -w ./bin/cat ./bin/sh | pax -0 | hexdump -C)
00000000 2e 2f 62 69 6e 2f 63 61 74 0a 2e 2f 62 69 6e 2f |./bin/cat../bin/|
00000010 73 68 0a |sh.|
00000013
Notice the `0a' bytes; I would expect `pax -0' to use `00'
instead.
>Fix:
Yes, please!
1. Use "%s", sep instead of "\n" here:
117 /*
118 * if not verbose, just print the file name
119 */
120 if (!vflag) {
=> 121 (void)fprintf(fp, "%s\n", arcn->name);
122 (void)fflush(fp);
123 return;
124 }
https://nxr.netbsd.org/xref/src/bin/pax/gen_subs.c?r=1.38#117
2. Consider doing something sensible for the long `-v' output
too.
Home |
Main Index |
Thread Index |
Old Index