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

loginitems Unusable Over su Session #1

Open
RandomDSdevel opened this issue Dec 21, 2016 · 5 comments
Open

loginitems Unusable Over su Session #1

RandomDSdevel opened this issue Dec 21, 2016 · 5 comments

Comments

@RandomDSdevel
Copy link

When I ran loginitems -l under su -l $OTHER_REDACTED_USER, I got the following error from osascript:

/usr/local/bin/loginitems-ls:68:72: execution error: An error of type -10810 has occurred. (-10810)

I suspect that this probably has to do with the fact that su does something funny and creates an execution environment that loginitems wasn't expecting. I don't recognize and couldn't find any documentation on that particular error code, though, so good luck if you decide to chase down the root cause of this problem. In the meantime, I'll just switch users to use loginitems under other accounts.

@OJFord
Copy link
Owner

OJFord commented Feb 4, 2017

It's an "unknown error", apparently.

According to this StackOverflow thread it might be related to a leaky third-party application.

Is it consistently reproducible, or immediately after restarting?

@OJFord
Copy link
Owner

OJFord commented Feb 4, 2017

It's also possible that the AppleScript interface to a user's login items can't be used under su, I don't have any other user accounts to test with, but it wouldn't surprise me.

@RandomDSdevel
Copy link
Author

It's an "unknown error", apparently.

According to this StackOverflow thread it might be related to a leaky third-party application.

Is it consistently reproducible, or immediately after restarting?

I haven't tried for a while, but, IIRC, the problem was consistently reproducible when I last did. I haven't attempted to see if restarting would help, either, but, for all we know, it might. I can try again if you want, though a dummy user account isn't all that hard to create, is it? (Recovering the accompanying user ID after the fact might turn out to be somewhat problematic, though, so I can understand your hesitancy to go through with doing that, as you might want to reuse ID 502 for another, different new user in the future.)


It's also possible that the AppleScript interface to a user's login items can't be used under su, I don't have any other user accounts to test with, but it wouldn't surprise me.

Yeah, I also suspect that the error might have to do with the fact that su only launches a TTY session and not a GUI one even when passed the -l option, as launchd or one of its child processes might only launch the osascript daemon under the latter kind of login session, so this wouldn't exactly surprise me, either. Still, it would be cool if there were a way around that…

@OJFord
Copy link
Owner

OJFord commented Feb 4, 2017

haven't attempted to see if restarting would help, either, but, for all we know, it might.

Indeed.

a dummy user account isn't all that hard to create, is it?

It's not a use-case I'm interested in using personally, and this repository contains all the AppleScript I have ever written, so I'm afraid I don't really have the time or inclination to explore this further.

That said,

Still, it would be cool if there were a way around that…

PRs are, genuinely, welcome. 🙂

@RandomDSdevel
Copy link
Author

RandomDSdevel commented Feb 4, 2017

Unfortunately, you've still got me beat when it comes to how much AppleScript you've written in your life. I'll put it on my to-do list to look into, but I can't promise anything, as I'd probably have to dive rather deep into the documentation to figure anything out in this area.

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

No branches or pull requests

2 participants