#607

jq: del(.[] | select(...)) and getpath(...) |= return wrong values, -j keeps quotes, inputs is missing

Openasafyishopened 14d ago

just-bash version

3.6.0

Reproduction

echo '[1,2,3]' | jq -c 'del(.[] | select(. == 2))'
echo '{"a":1}' | jq -c 'getpath(["a"]) |= 3'
echo '{"a":1}' | jq -j '.a, "x"'; echo
printf '1\n2\n' | jq -nc '[inputs]'
echo '{"a":1}' | jq '.a | error("boom")'

How you run it

import { Bash } from "just-bash";

const result = await new Bash().exec(script);

Expected behavior

jq 1.8.2:

[1,3]
{"a":3}
1x
[1,2]
jq: error (at <stdin>:1): boom

Actual behavior

[1,2,3]
3
1"x"
jq: error: Unknown function: inputs
jq: parse error: boom

The first two are the ones that worry me: they exit 0 with a wrong value, so a script can't notice. spec-tests/jq/skips.ts lists "path with select not supported". That's fine as a limitation, but then the filter should fail rather than hand back the input unchanged. For error(), only the "parse error" label is off; the exit code (5) matches.

Environment

  • Runtime (Node, Bun, browser, CLI): Node
  • Runtime version: 26.8.2
  • Operating system: macOS 15
  • Bundler or framework, when relevant: none

Activity

0

No activity yet.