anthonygelibert/QLColorCode

highlight crashes when previewing code file on Finder

marnovo opened this issue · 7 comments

highlight crashes when previewing code file on Finder. Happens with any language.

From the logs seems the problem might stem from lua and macOS 10.15+ sandboxing?
As in quicklookd <--- QLColorCode <--- highlight <-x- lua.

Running the latest versions available of qlcolorcode (3.1.1), highlight (3.58) and lua (5.3.5_1), all installed through Homebrew. Tried reinstalls of each already. OS is macOS 11 beta 7.

Log:

highlight cannot be opened because of a problem

Process:               highlight [57399]
Path:                  /usr/local/Cellar/highlight/3.58/bin/highlight
Identifier:            highlight
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        ??? [57395]
Responsible:           quicklookd [56903]
User ID:               503

Date/Time:             2020-09-21 10:46:24.321 +0200
OS Version:            Mac OS X 10.16 (20A5374g)
Report Version:        12
Bridge OS Version:     5.0 (18P50380a)
Anonymous UUID:        1B9A42F3-62F0-C8BC-8E68-BAD4387E7908

Sleep/Wake UUID:       33C2B357-4B50-4819-818A-BC6750B53BC8

Time Awake Since Boot: 290000 seconds
Time Since Wake:       2700 seconds

System Integrity Protection: enabled

Crashed Thread:        0

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    DYLD, [0x6] Filesystem Sandbox

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
  Library not loaded: /usr/local/opt/lua/lib/liblua.5.3.dylib
  Referenced from: /usr/local/bin/highlight
  Reason: no suitable image found.  Did find:
	file system sandbox blocked open() of '/usr/local/opt/lua/lib/liblua.5.3.dylib'
	file system sandbox blocked open() of '/usr/local/lib/liblua.5.3.dylib'
	file system sandbox blocked open() of '/usr/local/Cellar/lua/5.3.5_1/lib/liblua.5.3.5.dylib'

Binary Images:
       0x106b88000 -        0x106c3dfff +highlight (0) <3F6721F1-E589-3062-A8AA-EDCCDDA270F3> /usr/local/bin/highlight
       0x109717000 -        0x1097aefff  dyld (832.2.1) <89B0D57A-546A-3F6C-9BFB-D5179B29D542> /usr/lib/dyld
    0x7fff2aa90000 -     0x7fff2aa91fff  libSystem.B.dylib (1292) <AEE1824E-1AAC-356E-8EDE-704ED282BCA7> /usr/lib/libSystem.B.dylib

Have you tried running highlights from the terminal to see if it works?
Seems like a macos sandbox issue.

I agree with @sbarex … it seems more a problem of highlight sandboxing than QLColorCode…

Have you tried running highlights from the terminal to see if it works?

Thanks for the prompt reply. I did, from the terminal standalone highlight works normally as expected outputting syntax-highlighted code files.

What I am wondering is whether the whole dependency/call chain "inherits" sandboxing/privacy permissions from the application which calls them.

My terminal application has disk access/developer tools permissions set on macOS Privacy settings. I wanted to test the same with QLColorCode but unfortunately macOS doesn't allow you to choose .qlgenerator files when granting these permissions manually.

I have no 10.16 to test the problem… sorry…

On the Terminal you can try to check if the lua library have set some extended attribute:
ls -l@ /usr/local/Cellar/lua/5.3.5_1/lib/liblua.5.3.5.dylib
The output must be like this:
-r--r--r-- 1 sbarex staff 186828 Oct 31 2019 /usr/local/Cellar/lua/5.3.5_1/lib/liblua.5.3.5.dylib
If exists a quarantine extended attribute you must strip out with:
xattr -r -d com.apple.quarantine /usr/local/Cellar/lua/5.3.5_1/lib/liblua.5.3.5.dylib

@sbarex just tried your suggestion, the output is exactly like yours apart from username and date.
I'm not entirely sure if it was originally quarantined or not, because stripping the quarantine out was one of my first ideas, but I can attest the issue arises despite it.

Fixed in the latest version 😊! Thanks @Tatsh!!!