Severity: Low (found by a differential sweep while fixing #2909; pre-existing and unrelated to it)
Summary
del() over a path that pipes a slice into .. twice deletes more, or different, elements
than jq. Present on main and on the #2909 merge-base alike, and reproduces with no ?
anywhere, which is what rules out #2909's ?-group scope as the cause.
Repro
Captured live against /usr/bin/jq 1.7.1:
$ echo '[1,2,3]' | jq -c 'del((.[0:1] | .. | ..)?)'
[2,3]
$ echo '[1,2,3]' | succinctly jq -c 'del((.[0:1] | .. | ..)?)'
[3]
$ echo '[1,2,3]' | jq -c 'del(.[0:1] | .. | ..)' # no `?` at all
[2,3]
$ echo '[1,2,3]' | succinctly jq -c 'del(.[0:1] | .. | ..)'
[3]
More rows, same shape:
| input |
jq 1.7.1 |
succinctly |
[true,false] |
[false] |
[] |
[[1,2],[3]] |
[[3]] |
[] |
[{"a":1},5,{"a":3}] |
[5,{"a":3}] |
[{"a":3}] |
A single .. agrees; it takes two.
Root cause
Not investigated. The shape is a slice component followed by two recursive descents, which
produces overlapping and nested resolved paths — so the likely area is how the deletion trie
interns paths that are prefixes of one another after a slice step, rather than the descent
itself.
Why this is separate from #2909
#2909 is about a ? over a group being distributed onto the group's components instead of
scoping the whole group. This reproduces without a ?, and diverges identically on the
merge-base — the #2909 sweep (2,400 combinations) found these 8 rows and no others, and they
were unchanged by that fix.
Suggested fix direction
Start from del(.[0:1] | ..) (agrees) versus del(.[0:1] | .. | ..) (diverges) and diff the
resolved path lists the two produce, before looking at the trie. Capture the oracle for the
one-.., two-.. and three-.. forms over array, object and scalar-element inputs first —
the table will say whether this is about path count, path order, or prefix interning.
Refs #2909.
Severity: Low (found by a differential sweep while fixing #2909; pre-existing and unrelated to it)
Summary
del()over a path that pipes a slice into..twice deletes more, or different, elementsthan jq. Present on
mainand on the #2909 merge-base alike, and reproduces with no?anywhere, which is what rules out #2909's
?-group scope as the cause.Repro
Captured live against
/usr/bin/jq1.7.1:More rows, same shape:
[true,false][false][][[1,2],[3]][[3]][][{"a":1},5,{"a":3}][5,{"a":3}][{"a":3}]A single
..agrees; it takes two.Root cause
Not investigated. The shape is a slice component followed by two recursive descents, which
produces overlapping and nested resolved paths — so the likely area is how the deletion trie
interns paths that are prefixes of one another after a slice step, rather than the descent
itself.
Why this is separate from #2909
#2909 is about a
?over a group being distributed onto the group's components instead ofscoping the whole group. This reproduces without a
?, and diverges identically on themerge-base — the #2909 sweep (2,400 combinations) found these 8 rows and no others, and they
were unchanged by that fix.
Suggested fix direction
Start from
del(.[0:1] | ..)(agrees) versusdel(.[0:1] | .. | ..)(diverges) and diff theresolved path lists the two produce, before looking at the trie. Capture the oracle for the
one-
.., two-..and three-..forms over array, object and scalar-element inputs first —the table will say whether this is about path count, path order, or prefix interning.
Refs #2909.