-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
jq-1.6 - raw output doesn't work when -a is specified #1788
Comments
I think this problem was introduced on #1587 (bf88c73) that was trying to fix exactly the opposite problem (Can't use both the --raw-output and --ascii-output switches) FYI @rain-1 / @nicowilliams |
Using the same examples from #1587
|
Sorry if I broke something! I could not reproduce the segfault you mentioned. I'm not 100% sure what the fix for this would be. Let's discuss this. Currently we have
I understand that we want
But what about if a string is inside something else? Currently we have:
Do we want
or are we making a special case when the output is just a single string? |
Hey @rain-1 . No problem at all. Thanks for having a look at this. In our particular use case we use jq to process a json file that contains some binary values. For example something similar to this:
Using only
All 3 examples below (no flags, only -a, only -r) all work as expected as well
The problem comes when you try to combine
I would have expected the value from the example above without the quotes I normally use OSX. The problem above happens on both OSX and Linux but only Linux shows the SegFault error.
|
answering your second question from above, my view is that So in the first example below
|
OK. I agree. |
This patch makes a lone string printed without quotes in raw mode. Complex expression are still printed with quotes (non-raw) even in raw mode. The tests from the previous thread still work too.
tested with:
And please consider making a second issue about the segfault - maybe try to build from source first though, I could not reproduce the crash. |
I'm still running into the same segfault issue with the latest 1.6 downloaded from the website this morning and with the same built from source. Tried on two boxes with similar results: Using the latest download:
Using a built-from-source version:
On a colleague's Fedora box:
Note that in these cases, there are no non-ascii chars to deal with. |
Hello, building from source the patch i made #1789 produces this result:
Is this the correct/desired behavior? I have not been able to reproduce the segfault, has anybody else? I may try setting up fedora VM to test it. |
Good point. I was building from the main JQ master, not your fork. Building from rain-1/jq fixes the problem:
|
Escapes are still printed whenever characters outside the ASCII plane are encountered. To avoid ambiguity, backslash is the only ASCII character escaped (as `\\`). Fixes jqlang#1788, properly this time. Closes jqlang#1789.
Escapes are still printed whenever characters outside the ASCII plane are encountered. To avoid ambiguity, backslash is the only ASCII character escaped (as `\\`). Fixes jqlang#1788, properly this time. Closes jqlang#1789.
Escapes are still printed whenever characters outside the ASCII plane are encountered. To avoid ambiguity, backslash is the only ASCII character escaped (as `\\`). Fixes jqlang#1788, properly this time. Closes jqlang#1789.
Escapes are still printed whenever characters outside the ASCII plane are encountered. To avoid ambiguity, backslash is the only ASCII character escaped (as `\\`). Fixes jqlang#1788, properly this time. Closes jqlang#1789.
Escapes are still printed whenever characters outside the ASCII plane are encountered. To avoid ambiguity, backslash is the only ASCII character escaped (as `\\`). Fixes jqlang#1788, properly this time. Closes jqlang#1789.
Describe the bug
On jq 1.6, using the
-a
(ascii-output) and-r
(raw) options conflict.This problem doesn't happen on jq 1.5
To Reproduce
1.5
1.6
Notice how output still contain quotes despite the
-r
flag.Removing the
-a
flag produces the correct behaviourEnvironment (please complete the following information):
This problem is reproducible with both the
jq-linux64
andjq-osx-amd64
builds.The linux build even shows a
Segmentation fault
error:The text was updated successfully, but these errors were encountered: