Tarsnap / tarsnap

Command-line client code for Tarsnap.
https://tarsnap.com
Other
864 stars 60 forks source link

Add `--null-output` #614

Open gperciva opened 3 months ago

gperciva commented 3 months ago

The --null option was previously used for reading input with -T or -X. When we extended it to apply to --list-archives as well, we were using it to modify the output behaviour.

That wasn't ideal, but we could have lived with it, because there isn't any input to --list-archives.

However, consider the situation if we want NUL-separated output for -tvf. If we used --null for that, then if the user wanted to use -T it would force them to write that file with NUL bytes instead of newlines.

Adding --null-output allows the user to have different separators for the input and output. (We can think of "--null" as "--null-input", but we're not renaming it for historical / bsdtar-compatibility reasons.)

(Yes, if the user wanted newlines in output but NUL in input, they could do | sed -s 's/\x0/\n/g' but that's an awkward solution.)

gperciva commented 3 months ago

We allowed --null in --list-archives in #576, which was after tarsnap 1.0.40. It has not been part of a stable release, so I don't think it's a problem to change that to --null-output.