Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange behaviours of slurping streaming input without line terminators at the end #3273

Open
itchyny opened this issue Feb 24, 2025 · 0 comments · May be fixed by #3279
Open

Strange behaviours of slurping streaming input without line terminators at the end #3273

itchyny opened this issue Feb 24, 2025 · 0 comments · May be fixed by #3279
Labels

Comments

@itchyny
Copy link
Contributor

itchyny commented Feb 24, 2025

Describe the bug
When the input steam has no line terminator (and space) at the end, the combination of --slurp and --stream flags behaves oddly.

To Reproduce

 $ printf "[1]\n" | jq -c -s --stream .
[[[0],1],[[0]]] # ok

 $ printf "[1]" | jq -c -s --stream .  
[[[0],1]]
[[0]] # unexpected

Expected behavior
The second command outputs as same as the first command.

Environment (please complete the following information):

  • OS and Version: not related
  • jq version: 1.7.1 (and 1.7, 1.6)

Additional context
This is a close issue of #1534 but with the streaming parser flag.

@itchyny itchyny added the bug label Feb 24, 2025
itchyny added a commit to itchyny/jq that referenced this issue Mar 1, 2025
… character

This commit fixes a strange behavior of the combination of `--slurp` and
`--stream` flags when the input has no trailing newline character.
This fixes jqlang#3273.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant