Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --null-output #614

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add --null-output #614

wants to merge 3 commits into from

Conversation

gperciva
Copy link
Member

No description provided.

@gperciva
Copy link
Member Author

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
Copy link
Member Author

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.

This should have been part of:
    2023-08-30 Allow --list-archives --null
    d21dff3

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.  But suppose that we wanted to allow -T
with --list-archives --hashes (i.e. provide a filename which contains
hashes which we want to print)?  The user would be stuck with either
having NUL-separated both input and output, or having newlines for both.

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 "--null" for historical / bsdtar-compatibility reasons.)
These changes were made automatically via scripts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant