The argument that splits in two
An argument quoting fast path treats expansion syntax and high bytes as safe shell-word data.
What’s going wrong
A build helper prints shell arguments without quoting whenever it thinks they are safe. Inputs containing braces or a high-byte separator unexpectedly change how many arguments a shell sees. Do not run a shell: repair the encoder using the explicit contract below.
Each stdin line is one even-length hexadecimal argument, or - for an empty argument; at most 4096 decoded bytes overall. NUL bytes are excluded. Print a JSON array of lowercase-hex encoded quoted arguments. An argument may remain unquoted only when nonempty and every byte is ASCII alphanumeric or one of _@%+=:,./-. Otherwise wrap the complete argument in ASCII single quotes. Inside that quoted form, replace every original single quote with the five-byte sequence single-quote, double-quote, single-quote, double-quote, single-quote. Preserve every other byte exactly. Empty input means no arguments, while a line containing - means one empty argument.
This defines a canonical output, not every equivalent shell spelling. No actual commands, interactive terminal behavior or environment lookup are involved.
Expected behavior
Preserve complete argument identity across a security-sensitive encoding boundary, including empty and non-ASCII byte inputs.
Reproduction
7b7265642c626c75657d
["277b7265642c626c75657d27"]
616c7068612d312e747874
["616c7068612d312e747874"]
612062
["2761206227"]
Before you begin
- Rust strings, slices and loops
- Transfer context-specific classification to an all-bytes safety predicate rather than trusting a few familiar examples.
Need a nudge?
Reveal one investigation hint at a time. Try each clue before opening the next.
Read the report, then sign in to start your investigation.