anthonygelibert/QLColorCode

Bigsur 11.2.1 - bundled highlight crashes

wattsie opened this issue · 6 comments

Hi, I have two machines, both with 11.2.1.
On my laptop, QLColorCode works fine.
However on main desktop it fails.
When I try to execute the bundled "highlight" command it crashes.
I have tried fresh install from brew, fresh download from github, and a zipped copy from my working machine.
All seem to have same issue.

Wondering if anyone has any suggestions.

PS: tried using "xattr -cr", I have SIP disabled...

Many thanks.

When run manually from CLI

❯ ./highlight
[1]    2006 illegal hardware instruction  ./highlight

Some further investigation:

❯ qlmanage -p afile.js
Testing Quick Look preview with files:
	tailwind.config.js
2021-02-26 17:29:41.832 qlmanage[9580:58476] QLColorCode: colorize.sh failed with exit code 101.  Command was ('/Users/USER/Library/QuickLook/QLColorCode.qlgenerator/Contents/Resources/colorize.sh' '/Users/USER/Library/QuickLook/QLColorCode.qlgenerator/Contents/Resources' '/Users/USER/afile.js' 0).

then I try run

❯ '/Users/USER/Library/QuickLook/QLColorCode.qlgenerator/Contents/Resources/colorize.sh' '/Users/shane/Library/QuickLook/QLColorCode.qlgenerator/Contents/Resources' '/Users/USER/afile.js' 0
go4it:9: command not found: -D
go4it:9: command not found: -D

Crash Report

Process:               highlight [1610]
Path:                  /Users/USER/Library/QuickLook/QLColorCode.qlgenerator/Contents/Resources/highlight
Identifier:            highlight
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        zsh [550]
Responsible:           iTerm2 [410]
User ID:               501

Date/Time:             2021-02-26 16:51:39.508 +1100
OS Version:            macOS 11.2.1 (20D75)
Report Version:        12
Anonymous UUID:        000DD02D-14A8-2F49-1EE5-8C21A3855887


Time Awake Since Boot: 600 seconds

System Integrity Protection: disabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes:       0x0000000000000001, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Illegal instruction: 4
Termination Reason:    Namespace SIGNAL, Code 0x4
Terminating Process:   exc handler [1610]

Application Specific Information:
dyld2 mode

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   highlight                     	0x0000000101c43652 luaH_resize + 754
1   highlight                     	0x0000000101c42330 f_luaopen + 288
2   highlight                     	0x0000000101c33378 luaD_rawrunprotected + 88
3   highlight                     	0x0000000101c421ed lua_newstate + 477
4   highlight                     	0x0000000101c4f9d4 luaL_newstate + 20
5   highlight                     	0x0000000101c22668 Diluculum::LuaState::LuaState(bool) + 40
6   highlight                     	0x0000000101bb593a DataDir::loadFileTypeConfig(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 122
7   highlight                     	0x0000000101b5d025 HLCmdLineApp::run(int, char const**) + 309
8   highlight                     	0x0000000101b60af1 main + 49
9   libdyld.dylib                 	0x00007fff20376621 start + 1

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000001  rbx: 0xfffffffffffffffe  rcx: 0x0000000000000000  rdx: 0x0000000000000001
  rdi: 0x00007fd776004458  rsi: 0xfffffffffffffffe  rbp: 0x00007ffeee0ad960  rsp: 0x00007ffeee0ad8c0
   r8: 0x0000000000000047   r9: 0x000000000000004a  r10: 0x00000000fffffc7f  r11: 0x0000000000000000
  r12: 0x0000000000000002  r13: 0x00007fd7760044e0  r14: 0x00007fd776808208  r15: 0x0000000000000002
  rip: 0x0000000101c43652  rfl: 0x0000000000010297  cr2: 0x0000000101c36450
  
Logical CPU:     8
Error Code:      0x00000000
Trap Number:     6

Thread 0 instruction stream:
  10 48 ff cb 48 83 c7 10-48 39 de 75 f1 49 29 df  .H..H...H9.u.I).
  48 83 fa 07 72 41 4d 29-fc 49 c1 e7 04 4c 01 f8  H...rAM).I...L..
  48 83 c0 78 66 2e 0f 1f-84 00 00 00 00 00 c6 40  H..xf..........@
  90 10 c6 40 a0 10 c6 40-b0 10 c6 40 c0 10 c6 40  ...@...@...@...@
  d0 10 c6 40 e0 10 c6 40-f0 10 c6 00 10 48 83 e8  ...@...@.....H..
  80 49 83 c4 f8 75 d7 4c-89 75 b8 b8 01 00 00 00  .I...u.L.u......
 [c4]e2 71 f7 c0 4c 63 e0-80 f9 1f 75 2b 48 83 7d  ..q..Lc....u+H.}	<==
  c0 00 74 15 49 c1 e4 03-4b 8d 14 64 48 8b 7d b8  ..t.I...K..dH.}.
  48 8b 75 d0 e8 45 8c ff-ff 48 83 c4 78 5b 41 5c  H.u..E...H..x[A\
  41 5d 41 5e 41 5f 5d c3-45 31 f6 4c 8d bd 68 ff  A]A^A_].E1.L..h.
  ff ff 48 8b 5d d0 eb 1f-66 0f 1f 44 00 00 48 8b  ..H.]...f..D..H.
  0b 48 89 08 0f b6 4b 08-88 48 08 49 ff c6 48 83  .H....K..H.I..H.
  
Thread 0 last branch register state not available.

Binary Images:
       0x101b51000 -        0x101c8cfff +highlight (0) <4AEF2963-F593-3139-BAE7-4048ACFE4B67> /Users/USER/Library/QuickLook/QLColorCode.qlgenerator/Contents/Resources/highlight
       0x1114e1000 -        0x11157cfff  dyld (832.7.3) <0D4EA85F-7E30-338B-9215-314A5A5539B6> /usr/lib/dyld
    0x7fff2008f000 -     0x7fff20090fff  libsystem_blocks.dylib (78) <E644CAA0-65B7-36E4-8041-520F3301F3DB> /usr/lib/system/libsystem_blocks.dylib
    0x7fff20091000 -     0x7fff200c6fff  libxpc.dylib (2038.80.3) <70F26262-01AA-3CEC-9FAD-2701D24096F0> /usr/lib/system/libxpc.dylib
    0x7fff200c7000 -     0x7fff200defff  libsystem_trace.dylib (1277.80.2) <87FEF600-48D9-31C9-B8FC-D5249B2AE95D> /usr/lib/system/libsystem_trace.dylib
    0x7fff200df000 -     0x7fff2017efff  libcorecrypto.dylib (1000.80.5) <1EB11CFB-ABD7-36DD-97C7-C112A6601416> /usr/lib/system/libcorecrypto.dylib
    0x7fff2017f000 -     0x7fff201abfff  libsystem_malloc.dylib (317.40.8) <A498D1EF-E43D-310C-84E8-9C0AADA0C475> /usr/lib/system/libsystem_malloc.dylib
    0x7fff201ac000 -     0x7fff201f0fff  libdispatch.dylib (1271.40.12) <AD988EEA-1A2F-3404-9A6E-390FC2504223> /usr/lib/system/libdispatch.dylib
    0x7fff201f1000 -     0x7fff2022afff  libobjc.A.dylib (818.2) <0F399805-A533-3DC9-A951-1D3DF1442BD9> /usr/lib/libobjc.A.dylib
    0x7fff2022b000 -     0x7fff2022dfff  libsystem_featureflags.dylib (28.60.1) <9CECB43A-094E-3CA9-B730-24DEA1A6DE05> /usr/lib/system/libsystem_featureflags.dylib
    0x7fff2022e000 -     0x7fff202b6fff  libsystem_c.dylib (1439.40.11) <4AF71812-4099-3E96-B271-1F259491A2B2> /usr/lib/system/libsystem_c.dylib
    0x7fff202b7000 -     0x7fff2030cfff  libc++.1.dylib (904.4) <B217D905-4F9C-3DE0-8844-88FAA3C2C851> /usr/lib/libc++.1.dylib
    0x7fff2030d000 -     0x7fff20325fff  libc++abi.dylib (904.4) <3C9FE530-3CD2-3A64-8A36-70816AEBDF0D> /usr/lib/libc++abi.dylib
    0x7fff20326000 -     0x7fff20354fff  libsystem_kernel.dylib (7195.81.3) <AB413518-ECDE-3F04-A61C-278D3CF43076> /usr/lib/system/libsystem_kernel.dylib
    0x7fff20355000 -     0x7fff20360fff  libsystem_pthread.dylib (454.80.2) <B989DF6C-ADFE-3AF9-9C91-07D2521F9E47> /usr/lib/system/libsystem_pthread.dylib
    0x7fff20361000 -     0x7fff2039bfff  libdyld.dylib (832.7.3) <4641E48F-75B5-3CC7-8263-47BF79F15394> /usr/lib/system/libdyld.dylib
    0x7fff2039c000 -     0x7fff203a5fff  libsystem_platform.dylib (254.80.2) <1C3E1A0A-92A8-3CDE-B622-8940B43A5DF2> /usr/lib/system/libsystem_platform.dylib
    0x7fff203a6000 -     0x7fff203d1fff  libsystem_info.dylib (542.40.3) <0C96CFE8-71F5-3335-8423-581BC3DE5846> /usr/lib/system/libsystem_info.dylib
    0x7fff226f5000 -     0x7fff226fefff  libsystem_darwin.dylib (1439.40.11) <E016D8F7-C87F-36F8-B8A0-6A61B8E4BACB> /usr/lib/system/libsystem_darwin.dylib
    0x7fff22b10000 -     0x7fff22b1bfff  libsystem_notify.dylib (279.40.4) <B2BF20C7-448A-3FBD-A2F5-AB7618D173F6> /usr/lib/system/libsystem_notify.dylib
    0x7fff24a6c000 -     0x7fff24a7afff  libsystem_networkextension.dylib (1295.80.3) <5213D866-7D0E-3FD9-8E1A-03C0E39CEC44> /usr/lib/system/libsystem_networkextension.dylib
    0x7fff24ad8000 -     0x7fff24aeefff  libsystem_asl.dylib (385) <5B48071E-85EB-33B0-AE9B-127AEB398AEC> /usr/lib/system/libsystem_asl.dylib
    0x7fff26206000 -     0x7fff2620dfff  libsystem_symptoms.dylib (1431.40.36) <BC85B46C-02EE-31FF-861D-F0DE01E8F6CF> /usr/lib/system/libsystem_symptoms.dylib
    0x7fff28538000 -     0x7fff28548fff  libsystem_containermanager.dylib (318.80.2) <6F08275F-B912-3D8E-9D74-4845158AE4F3> /usr/lib/system/libsystem_containermanager.dylib
    0x7fff2924c000 -     0x7fff2924ffff  libsystem_configuration.dylib (1109.60.2) <4917D824-4DE8-32CC-9ED2-1FBF371FEB9F> /usr/lib/system/libsystem_configuration.dylib
    0x7fff29250000 -     0x7fff29254fff  libsystem_sandbox.dylib (1441.60.4) <5F7F3DD1-4B38-310C-AA8F-19FF1B0F5276> /usr/lib/system/libsystem_sandbox.dylib
    0x7fff29e5f000 -     0x7fff29e61fff  libquarantine.dylib (119.40.2) <40D35D75-524B-3DA6-8159-E7E0FA66F5BC> /usr/lib/system/libquarantine.dylib
    0x7fff2a3e2000 -     0x7fff2a3e6fff  libsystem_coreservices.dylib (127) <529A0663-A936-309C-9318-1B04B7F70658> /usr/lib/system/libsystem_coreservices.dylib
    0x7fff2a5fd000 -     0x7fff2a648fff  libsystem_m.dylib (3186.40.2) <7BE9BAE3-ADED-35DD-B920-34F590BAB507> /usr/lib/system/libsystem_m.dylib
    0x7fff2a64a000 -     0x7fff2a64ffff  libmacho.dylib (973.4) <C2584BC4-497B-3170-ADDF-21B8E10B4DFD> /usr/lib/system/libmacho.dylib
    0x7fff2a66c000 -     0x7fff2a677fff  libcommonCrypto.dylib (60178.40.2) <822A29CE-BF54-35AD-BB15-8FAECB800C7D> /usr/lib/system/libcommonCrypto.dylib
    0x7fff2a678000 -     0x7fff2a682fff  libunwind.dylib (200.10) <1D0A4B4A-4370-3548-8DC1-42A7B4BD45D3> /usr/lib/system/libunwind.dylib
    0x7fff2a683000 -     0x7fff2a68afff  liboah.dylib (203.30) <44C477D9-013F-3A6D-A9FE-68A89214E6A5> /usr/lib/liboah.dylib
    0x7fff2a68b000 -     0x7fff2a695fff  libcopyfile.dylib (173.40.2) <39DBE613-135B-3AFE-A6AF-7898A37F70C2> /usr/lib/system/libcopyfile.dylib
    0x7fff2a696000 -     0x7fff2a69dfff  libcompiler_rt.dylib (102.2) <62EE1D14-5ED7-3CEC-81C0-9C93833641F1> /usr/lib/system/libcompiler_rt.dylib
    0x7fff2a69e000 -     0x7fff2a6a0fff  libsystem_collections.dylib (1439.40.11) <C53D5E0C-0C4F-3B35-A24B-E0D7101A3F95> /usr/lib/system/libsystem_collections.dylib
    0x7fff2a6a1000 -     0x7fff2a6a3fff  libsystem_secinit.dylib (87.60.1) <E05E35BC-1BAB-365B-8BEE-D774189EFD3B> /usr/lib/system/libsystem_secinit.dylib
    0x7fff2a6a4000 -     0x7fff2a6a6fff  libremovefile.dylib (49.40.3) <5CC12A16-82CB-32F0-9040-72CFC88A48DF> /usr/lib/system/libremovefile.dylib
    0x7fff2a6a7000 -     0x7fff2a6a7fff  libkeymgr.dylib (31) <803F6AED-99D5-3CCF-B0FA-361BCF14C8C0> /usr/lib/system/libkeymgr.dylib
    0x7fff2a6a8000 -     0x7fff2a6affff  libsystem_dnssd.dylib (1310.80.1) <E0A0CAB3-6779-3C83-AC67-046CFE69F9C2> /usr/lib/system/libsystem_dnssd.dylib
    0x7fff2a6b0000 -     0x7fff2a6b5fff  libcache.dylib (83) <1A98B064-8FED-39CF-BB2E-5BDA1EF5B65A> /usr/lib/system/libcache.dylib
    0x7fff2a6b6000 -     0x7fff2a6b7fff  libSystem.B.dylib (1292.60.1) <83503CE0-32B1-36DB-A4F0-3CC6B7BCF50A> /usr/lib/libSystem.B.dylib
    0x7fff2dc4b000 -     0x7fff2dc4bfff  liblaunch.dylib (2038.80.3) <C7C51322-8491-3B78-9CFA-2B4753662BCF> /usr/lib/system/liblaunch.dylib
    0x7fff300ff000 -     0x7fff300fffff  libsystem_product_info_filter.dylib (8.40.1) <20310EE6-2C3F-361A-9ECA-4223AFC03B65> /usr/lib/system/libsystem_product_info_filter.dylib


Tatsh commented

Try running:

❯ '/Users/USER/Library/QuickLook/QLColorCode.qlgenerator/Contents/Resources/colorize.sh' '/Users/shane/Library/QuickLook/QLColorCode.qlgenerator/Contents/Resources/highlight' '/Users/USER/afile.js' 0

The first argument to colorize.sh must be a path to highlight not just a directory.

Yep, still get :

go4it:9: command not found: -D
go4it:9: command not found: -D

Running:
❯ /Users/USER/Library/QuickLook/QLColorCode.qlgenerator/Contents/Resources/highlight
gives:
[1] 77700 illegal hardware instruction

Weird.

PS: just uninstalled and reinstalled, same result.

Many thanks.

By 'desktop' what machine are you referring to?

Mac Pro (Late 2013)
2.7 GHz 12-Core Intel Xeon E5
64 GB 1866 MHz DDR3
MacOS Big Sir 11.2.1 (20D75)

PS: Thanks and sorry for being a hassle.

Many thanks.

Tatsh commented

Highlight and Lua are unfortunately built in a different way compared to the rest of the code, and I think both get different CPU optimisations that may only work on the machine that compiled it (and similar ones). Since your Xeon CPU is a bit older, the binary may indeed have an instruction it cannot understand. This should be fixed by having the Lua/HL code build with -march=x86-64 or similar.

Could you run sysctl machdep.cpu.features on both machines and give the output?

It would also be good if you could try to build it yourself and see if it works.

Hey, thanks heaps, sounds likely....

My tomorrow I can try compiling locally can report back.

For reference:

Mac Pro (Late 2013) - Xeon:
machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX SMX EST TM2 SSSE3 CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC POPCNT AES PCID XSAVE OSXSAVE TSCTMR AVX1.0 RDRAND F16C

MacBook Pro (16-inch, 2019) - 2.4 GHz 8-Core Intel Core i9:
machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C