jq
jq copied to clipboard
`test` that evaluates to `true` segfaults
Describe the bug
jq
throws a segmentation fault when test
returns true
.
To Reproduce
-
Install
jq-1.6
-
Pipe in some data and apply a
test
that evaluates totrue
:print "\"bar\"" | jq 'test("bar")' [1] 20397 done print "\"bar\"" | 20398 segmentation fault jq 'test("bar")'
Expected behavior
The expected result is true
.
Compare to data with a test
that evaluates to false
:
print "\"foo\"" | jq 'test("bar")'
false
Environment (please complete the following information):
- macOS Catalina v10.15
- jq-1.6
This works as expected/documented on jq-1.5
@amsross - FYI, there's never been this kind of problem using jq on macOS High Sierra. Could the problem you've encountered have something to do with Catalina?
@pkoppstein I wouldn't at all be surprised if that were the case, but I don't think there's anything I can do to change that. I've downgraded to jq-1.5
to circumvent the issue.
@amsross I can't upgrade my computers to catalina right now (thanks Apple for removing 32-bit support) Did you happen to get any kind of stack information? Would you be able/willing to share the relevant the error report from Console.app? (please do snip anything personally identifying out of it)
I'm not sure if this is related, but the statically linked version:
./jq --version jq-master-9b51a08-dirty
..compiled from the git code also segfaults on Ubuntu 18.04:
./jq --help Segmentation fault (core dumped)
From make -j8 LDFLAGS=-all-static:
./.libs/libjq.a(util.o): In function `get_home': /home/daadmin/StdUtils/jq/src/util.c:106: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
file ./jq ./jq: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 3.2.0, BuildID[sha1]=dc4071683be5cc019af11c7374111ebfc9a46d01, with debug_info, not stripped
Similar test case that is failing for me on Catalina.
echo "\"abc abc\"" | jq 'match("(abc)+"; "g")'
Produces this in Console.app:
Process: jq [65172]
Path: /usr/local/Cellar/jq/1.6/bin/jq
Identifier: jq
Version: 0
Code Type: X86-64 (Native)
Parent Process: zsh [54685]
Responsible: Terminal [54683]
User ID: 501
Date/Time: 2019-11-01 13:50:09.688 -0700
OS Version: Mac OS X 10.15 (19A583)
Report Version: 12
Bridge OS Version: 3.0 (14Y906)
Anonymous UUID: 18E28310-2DCF-EF91-C5DE-836387B2060B
Sleep/Wake UUID: D77661D6-BF9C-45B4-9B3E-545A5BD38A3A
Time Awake Since Boot: 440000 seconds
Time Since Wake: 940 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: EXC_I386_GPFLT
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [65172]
Application Specific Information:
dyld2 mode
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libonig.5.dylib 0x00000001003318a6 match_at + 662
1 libonig.5.dylib 0x0000000100336cd5 onig_search_with_param + 1241
2 libonig.5.dylib 0x00000001003367d3 onig_search + 83
3 jq 0x00000001002dd048 f_match + 1204
4 jq 0x00000001002e4cd1 jq_next + 400
5 jq 0x00000001002d78ce process + 37
6 jq 0x00000001002d72cd main + 4753
7 libdyld.dylib 0x00007fff65489405 start + 1
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x00007fab98c3ef60 rbx: 0x0000000000000010 rcx: 0x000000010038a150 rdx: 0x0000000000000001
rdi: 0x00007fab98c3fed0 rsi: 0x0000000000000000 rbp: 0x00007ffeef92a3f0 rsp: 0x00007ffeef928d90
r8: 0x00007ffeef928d90 r9: 0x0000000000000000 r10: 0x000000010031c518 r11: 0x00007fab98c3ef63
r12: 0x00007fab98c3ef60 r13: 0x00007ffeef928d90 r14: 0x00007ffeef928d98 r15: 0x00007fab98c3fed0
rip: 0x00000001003318a6 rfl: 0x0000000000010246 cr2: 0x0000000100336780
Logical CPU: 0
Error Code: 0x00000000
Trap Number: 13
Binary Images:
0x1002d5000 - 0x10030bffb +jq (0) <155ACB11-FD85-364C-8D78-BF5DCA93B4D4> /usr/local/bin/jq
0x10031c000 - 0x100387ff7 +libonig.5.dylib (0) <3CB1FA9A-87E3-33DF-8320-48F15782F29D> /usr/local/opt/oniguruma/lib/libonig.5.dylib
0x10a5bd000 - 0x10a64b93f dyld (732.8) <42C11B81-6928-369F-B03E-D57355572700> /usr/lib/dyld
0x7fff622f5000 - 0x7fff622f6ff3 libSystem.B.dylib (1281) <66742D2E-591A-32B2-8E92-4A54BEE843F6> /usr/lib/libSystem.B.dylib
0x7fff625d3000 - 0x7fff62626fff libc++.1.dylib (800.6) <328FB687-2363-38B1-AC11-11736925C775> /usr/lib/libc++.1.dylib
0x7fff62627000 - 0x7fff6263bfff libc++abi.dylib (800.7) <02753D3D-91C6-3670-8B5D-EBE040B516FC> /usr/lib/libc++abi.dylib
0x7fff64118000 - 0x7fff64149fe6 libobjc.A.dylib (779.1) <722C0959-69B8-3843-B5EA-CDD8FAA91D5E> /usr/lib/libobjc.A.dylib
0x7fff65264000 - 0x7fff65269ff7 libcache.dylib (83) <8EC69760-6DAA-3068-9372-F1D554C548E5> /usr/lib/system/libcache.dylib
0x7fff6526a000 - 0x7fff65275ff7 libcommonCrypto.dylib (60165) <698BE754-137D-361D-B826-57B8DD969E4A> /usr/lib/system/libcommonCrypto.dylib
0x7fff65276000 - 0x7fff6527dfff libcompiler_rt.dylib (101.2) <0BE7F119-C9C2-3612-A3F4-2336D4444476> /usr/lib/system/libcompiler_rt.dylib
0x7fff6527e000 - 0x7fff65287ff7 libcopyfile.dylib (166) <B5E73B1C-0BCF-33FE-80A1-D9E3BA3033D4> /usr/lib/system/libcopyfile.dylib
0x7fff65288000 - 0x7fff6531ffc3 libcorecrypto.dylib (866.0.10) <58344B13-CD10-3697-A516-6F5B06DD1EB7> /usr/lib/system/libcorecrypto.dylib
0x7fff65436000 - 0x7fff65477ff0 libdispatch.dylib (1173.0.3) <F4260D89-F67D-30CB-AF61-7ED25CB687DB> /usr/lib/system/libdispatch.dylib
0x7fff65478000 - 0x7fff654adfff libdyld.dylib (732.8) <98960E27-A08B-36DA-A5CB-8538B2D6757E> /usr/lib/system/libdyld.dylib
0x7fff654ae000 - 0x7fff654aeffb libkeymgr.dylib (30) <682B41BC-BDC2-38D5-8820-87099606FA12> /usr/lib/system/libkeymgr.dylib
0x7fff654bc000 - 0x7fff654bcff7 liblaunch.dylib (1738.11.1) <7FE11F0D-65BC-3726-B1DD-E84F329193E0> /usr/lib/system/liblaunch.dylib
0x7fff654bd000 - 0x7fff654c2ff7 libmacho.dylib (949.0.1) <163DFE06-2FAD-3CBC-80EF-C38EED6AEA52> /usr/lib/system/libmacho.dylib
0x7fff654c3000 - 0x7fff654c5ff3 libquarantine.dylib (110.0.4) <C8F39330-8CB5-30B0-8564-96453DCEFAD7> /usr/lib/system/libquarantine.dylib
0x7fff654c6000 - 0x7fff654c7ff7 libremovefile.dylib (48) <FB280185-B5ED-3F08-B08A-A378865C1398> /usr/lib/system/libremovefile.dylib
0x7fff654c8000 - 0x7fff654dffff libsystem_asl.dylib (377.0.1) <30CE9DAF-B1FA-3510-832B-F1CE19933ED7> /usr/lib/system/libsystem_asl.dylib
0x7fff654e0000 - 0x7fff654e0fff libsystem_blocks.dylib (74) <E0B8C825-E62B-357E-A2A0-13776F0A0F8C> /usr/lib/system/libsystem_blocks.dylib
0x7fff654e1000 - 0x7fff65568ff7 libsystem_c.dylib (1353.11.2) <2A5BFAFE-8214-3B35-AD46-C07A1A8B8941> /usr/lib/system/libsystem_c.dylib
0x7fff65569000 - 0x7fff6556cfff libsystem_configuration.dylib (1061.0.2) <56174463-22ED-337F-B0D4-94995DCDB9B7> /usr/lib/system/libsystem_configuration.dylib
0x7fff6556d000 - 0x7fff65570ff7 libsystem_coreservices.dylib (114) <01695913-028E-3AE1-8D4E-2B2769109811> /usr/lib/system/libsystem_coreservices.dylib
0x7fff65571000 - 0x7fff65578fff libsystem_darwin.dylib (1353.11.2) <4CE52C63-87AA-3C6D-899F-8C983E5FC061> /usr/lib/system/libsystem_darwin.dylib
0x7fff65579000 - 0x7fff65580ffb libsystem_dnssd.dylib (1096.0.2) <DC7381E8-F09F-3441-8267-9B8F50A0EBA9> /usr/lib/system/libsystem_dnssd.dylib
0x7fff65581000 - 0x7fff65582ffb libsystem_featureflags.dylib (17) <DBCA4AA2-CA05-38D5-AB4B-BE0F3E09BB8B> /usr/lib/system/libsystem_featureflags.dylib
0x7fff65583000 - 0x7fff655d0ff7 libsystem_info.dylib (538) <9F9D6368-A11E-32F1-9BB5-C153F42EFED8> /usr/lib/system/libsystem_info.dylib
0x7fff655d1000 - 0x7fff655fdfff libsystem_kernel.dylib (6153.11.26) <4CE9D54A-A975-348E-B878-EE74EDFC956B> /usr/lib/system/libsystem_kernel.dylib
0x7fff655fe000 - 0x7fff65645ff7 libsystem_m.dylib (3178) <4F516261-0C0E-3105-AF35-EF39D6347B50> /usr/lib/system/libsystem_m.dylib
0x7fff65646000 - 0x7fff6566dfff libsystem_malloc.dylib (283) <02925539-3CBA-39EB-BA6B-9A936CFA0BF8> /usr/lib/system/libsystem_malloc.dylib
0x7fff6566e000 - 0x7fff6567bff3 libsystem_networkextension.dylib (1095.11.9) <8B5EE189-E3D1-31FD-878F-50286B6E7047> /usr/lib/system/libsystem_networkextension.dylib
0x7fff6567c000 - 0x7fff65685fff libsystem_notify.dylib (241) <89381127-2A07-3F07-B865-358FACCF9102> /usr/lib/system/libsystem_notify.dylib
0x7fff65686000 - 0x7fff6568ffe7 libsystem_platform.dylib (220) <90E508E4-46D8-33FF-8552-DDAA079977A0> /usr/lib/system/libsystem_platform.dylib
0x7fff65690000 - 0x7fff6569afff libsystem_pthread.dylib (416.11.1) <2EA6F95F-F264-30B6-8AF2-24197B5AED84> /usr/lib/system/libsystem_pthread.dylib
0x7fff6569b000 - 0x7fff6569fffb libsystem_sandbox.dylib (1217.11.16) <51129CBB-BC46-37F1-A1B5-ECFA9530704D> /usr/lib/system/libsystem_sandbox.dylib
0x7fff656a0000 - 0x7fff656a2fff libsystem_secinit.dylib (62.0.4) <A48D9AF3-75F2-3331-A0C8-0A23771F4AC7> /usr/lib/system/libsystem_secinit.dylib
0x7fff656a3000 - 0x7fff656aaffb libsystem_symptoms.dylib (1238.0.2) <08E8CF75-5F77-3475-A48E-A01CBDF09173> /usr/lib/system/libsystem_symptoms.dylib
0x7fff656ab000 - 0x7fff656c1ff2 libsystem_trace.dylib (1147.0.3) <5836645E-9862-326D-AB3B-A19E76BE29B9> /usr/lib/system/libsystem_trace.dylib
0x7fff656c3000 - 0x7fff656c8ffb libunwind.dylib (35.4) <F5AE1D43-7C5F-3BA2-94D3-E769F82C0F61> /usr/lib/system/libunwind.dylib
0x7fff656c9000 - 0x7fff656fdff6 libxpc.dylib (1738.11.1) <2E9076CD-6C0E-38B6-8403-B2DDCE125FBF> /usr/lib/system/libxpc.dylib
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 1912243
thread_create: 0
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=353.5M resident=0K(0%) swapped_out_or_unallocated=353.5M(100%)
Writable regions: Total=28.3M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=28.3M(100%)
VIRTUAL REGION
REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
Kernel Alloc Once 8K 1
MALLOC 20.1M 11
MALLOC guard page 16K 3
STACK GUARD 56.0M 1
Stack 8192K 1
__DATA 632K 42
__DATA_CONST 28K 2
__LINKEDIT 348.3M 4
__OBJC_RO 31.8M 1
__OBJC_RW 1760K 1
__TEXT 5396K 41
shared memory 8K 2
=========== ======= =======
TOTAL 471.8M 110
Running into the same issue as well.
Also affected by this.
I have this problem, how can I get version 1.5 if that fixes this? Home-brew won't allow me to install that version and I can't get the version to build on macos because of some python issue. There's no requirements listed for the installation and I don't want to waste more time on it in case there are more dependencies past that point.
Just updated to Mac OS 10.15.2 and I can no longer replicate this. I also did a brew upgrade in there, not sure what fixed it.
I am on 10.15.3 and have been having this problem. I tried a brew upgrade but there was no update available. I did a brew uninstall and then brew install again and the problem went away.
I am on 10.15.7 and don't see this problem with jq
version 1.6
:
╰─ print "\"foo\"" | jq 'test("bar")'
false
╰─ print "\"bar\"" | jq 'test("bar")'
true
╰─ jq --version
jq-1.6
╰─ jq -h | head -n 2
jq - commandline JSON processor [version 1.6]
It's now 2023, and I'm using macOS Ventura (13.4.1), I cannot reproduce. Is there anyone still affected by this issue?
No longer reproducible in the stated situation.