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

Flashlight not injecting plugins when user ScriptingAdditions directory is not writable #246

Closed
kopischke opened this issue Jan 7, 2015 · 4 comments

Comments

@kopischke
Copy link

Breaking this out of #38, which seems to have been lost in translation: Flashlight up to and including release 0.95.4 will not inject its plugins into Spotlight if ~/Library/ScriptingAdditions is not writable. Console log shows the following relevant terror messages:

01.12.14 12:26:33,872 com.nateparrott.Flashlight.FlashlightSIMBLAgent[82703]: Cannot make directory /Users/martin/Library/ScriptingAdditions/Flashlight.osax: Permission denied
01.12.14 12:26:33,885 com.nateparrott.Flashlight.FlashlightSIMBLAgent[82703]: #Flashlight SIMBLlinkItemAtPath error:Error Domain=NSCocoaErrorDomain Code=513 "“Flashlight.osax” couldn’t be linked because you don’t have permission to access “ScriptingAdditions”." UserInfo=0x7f9eabd582d0 {NSSourceFilePathErrorKey=/Applications/Flashlight.app/Contents/Library/LoginItems/FlashlightSIMBLAgent.app/Contents/PlugIns/Flashlight.osax, NSUserStringVariant=(
    Link
), NSDestinationFilePath=/Users/martin/Library/ScriptingAdditions/Flashlight.osax, NSFilePath=/Applications/Flashlight.app/Contents/Library/LoginItems/FlashlightSIMBLAgent.app/Contents/PlugIns/Flashlight.osax, NSUnderlyingError=0x7f9eabd57b90 "The operation couldn’t be completed. Permission denied"}

Permissions for ~/Library/ScriptingAdditions are as follows (set by OS X, no user intervention):

drwx------   2 root    staff

OS X 10.10.1 German locale, iMac 21.5″ end 2012 model

@nate-parrott
Copy link
Owner

Thanks for the report!

Do you have any idea why your ~/Library/ScriptingAdditions directory isn't writeable? It doesn't seem likely that it's protected by default. It's writeable on my machine, I never remember changing it explicitly, and I've installed Flashlight on some fairly clean installs of Yosemite. None of them have this problem.

It should be possible to change the directory in which the Flashlight.osax code injection bundle is saved to, but I'm not sure it make sense if this isn't a common issue. You may also want to bring this question up with the EasySIMBL team, since the code that touches ScriptingAdditions is forked from theirs, and they understand it better than I do.

@kopischke
Copy link
Author

You are right: the folder is not protected by default. That is because since at least OS X 10.8 the ~/Library/ScriptingAdditions folder does not exist by default (I did a bit of sleuthing by sampling a few machines of coworkers and family members less prone to fiddling than I am; none of them has that folder in ~/Library; most of them updated to 10.10 from 10.8 or 10.9), meaning it has to created by the first software that wants to install there. If that software runs in the user’s context, all is fine; if, however, that first installer runs in another context, or choose to elevate privileges when creating the folder, other software that relies on scripting additions in the user folder and expects that folder to be writable without privilege elevation will silently (and to most users: inexplicably) fail to work.

I cannot judge how common this kind of scenario is, as it is rather hard to diagnose: even to savvy users, this kind of failure looks somewhat inscrutable. A solution would be checking the writability of the folder and elevating privileges if needed before linking the osax; as to deciding if that has to happen in your fork or upstream first, or that it is a corner case not worth your time, that is your call to make :).

Personally, I’ll go with

sudo chown -R martin:staff ~/Library/ScriptingAdditions

@nate-parrott
Copy link
Owner

Interesting. Just got an email from another person with the issue. If the case of other apps creating ~/Library/ScriptingAdditions is at all common, we should do something about it.

Do you think it makes sense to use a directory other than ScriptingAdditions? ("FlashlightSupport?"). I'd rather not ask the user to grant root, as it might scare people. Would this work? I'll probably experiment with find+replacing ScriptingAdditions with something else in the source and seeing if everything still works...

@kopischke
Copy link
Author

I think that is what ~/Library/Application Support/Flashlight is for :). The ScriptingAdditions folder is meant for general purpose extensions anyway, so a single application extension like Flashlight’s doesn’t necessarily need to go there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants