Skip to content
Myr

EOF after newline in string mishandled (fix #951)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Nicolas Williams · committed by David Tolnay · parent 58f082d · Browse files · 2 files+13 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+13 added−4 removed

  • tests:+12 added−1 removed
  • other:+1 added−3 removed

2 files+13 added−4 removed

modified:src/util.c+1 added-3 removed
433 unmodified lines
434 }435 } else {436 if (jv_parser_remaining(state->parser) == 0) {437 is_last = jq_util_input_read_more(state);438 if (is_last && state->buf_valid_len == 0) {438 if (is_last && state->buf_valid_len == 0)439 value = jv_invalid();440 break;441 }440 jv_parser_set_buf(state->parser, state->buf, state->buf_valid_len, !is_last);441 }442 value = jv_parser_next(state->parser);443 if (jv_is_valid(state->slurped)) {
17 unmodified lines
modified:tests/shtest+12 added-1 removed
107 unmodified lines
108printf '1' | $JQ -ce --seq . > $d/out 2>&1109cmp $d/out $d/expected110111cat > $d/expected <<EOF112jq: error (at <stdin>:1): Unfinished abandoned text at EOF at line 2, column 0113EOF113printf '1\n' | $JQ -cen --seq '[inputs] == []' >/dev/null 2> $d/out114if printf '1\n' | $JQ -cen --seq '[inputs] == []' >/dev/null 2> $d/out; then115 printf 'Error expected but jq exited successfully\n' 1>&2116 exit 2117fi118cmp $d/out $d/expected119120# Regression test for #951121printf '"a\n' > $d/input122if $VALGRIND $Q $JQ -e . $d/input; then123 printf 'Issue #951 is back?\n' 1>&2124 exit 2125fi126127## Test streaming parser128129## If we add an option to stream to the `import ... as $symbol;` directive130## then we can move these tests into tests/all.test.
86 unmodified lines