1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

Rename --nul-output to --raw-output0, abort on string containing NUL

The option naming --nul-output was confusing, especially when we have a
similar option for input stream in the future (--nul-input vs --null-input).
Based on the observation of other command line tools, we rename the option
to --raw-output0. We also drop the short option -0 to avoid confusion on
introducing the NUL-delimited input option.

Unlike the other command line tools outputting file names with NUL delimiter,
jq deals with JSON, and its strings may contain NUL character. To protect
users from the risk of injection attacks, we abort the program and print an
error message before outputting strings including NUL character. Closes #2683.
This commit is contained in:
itchyny
2023-07-10 07:30:50 +09:00
committed by Nico Williams
parent 13fbe98dff
commit a1e791acf8
4 changed files with 41 additions and 30 deletions

View File

@@ -136,14 +136,15 @@ sections:
formatted as a JSON string with quotes. This can be useful for
making jq filters talk to non-JSON-based systems.
* `--join-output` / `-j`:
Like `-r` but jq won't print a newline after each output.
* `--nul-output` / `-0`:
* `--raw-output0`:
Like `-r` but jq will print NUL instead of newline after each output.
This can be useful when the values being output can contain newlines.
When the output value contains NUL, jq exits with non-zero code.
* `--join-output` / `-j`:
Like `-r` but jq won't print a newline after each output.
* `--ascii-output` / `-a`: