matryer / xbar

Put the output from any script or program into your macOS Menu Bar (the BitBar reboot)
https://xbarapp.com
MIT License
17.55k stars 643 forks source link

LSOpenURLsWithRole() failed with error -600 #693

Open xfangfang opened 3 years ago

xfangfang commented 3 years ago

I try to refresh the plugin by: open -jg 'xbar://app.xbarapp.com/refreshPlugin?path=plugin.py' And I got: LSOpenURLsWithRole() failed with error -600 for the URL xbar://app.xbarapp.com/refreshPlugin?path=plugin.py.

I guess some settings of my computer may cause this problem. Does anyone have similar problems?

System version: MACOS 10.15.7

matryer commented 3 years ago

@xfangfang The internet tells me this is usually a permissions error. Are you able to run xbar? Did you install it by dragging it into the Applications folder?

xfangfang commented 3 years ago

@matryer I can use xbax. After download it, I drag it to the application folder. When first time I run it, shows that because of untrusted developers I can't open, and I go to settings to allow xbar to be opened.

Also tried: sudo open -jg 'xbar://app.xbarapp.com/refreshPlugin?path=plugin.py' Shows the same to before.

Thank you very much for your reply.

matryer commented 3 years ago

@xfangfang You're welcome.

Does plugin.py definitely exist in the ~/Library/Application Support/xbar/plugins folder?

xfangfang commented 3 years ago

try 001-age-ticker.1s.py got the same error

(jupyter369) xfangfangs-MBP:plugins fang$ pwd
/Users/fang/Library/Application Support/xbar/plugins
(jupyter369) xfangfangs-MBP:plugins fang$ ls -lah
total 96
drwxr-xr-x  8 fang  staff   256B  4  6 19:00 .
drwxr-xr-x  5 fang  staff   160B  4  5 21:23 ..
-rwxr-xr-x@ 1 fang  staff   893B  4  6 19:00 001-age-ticker.1s.py
(jupyter369) xfangfangs-MBP:Contents fang$ ls -lah /Applications/xbar.app
total 0
drwxr-xr-x   3 fang  admin    96B  4  6 06:30 .
drwxrwxr-x+ 88 root  admin   2.8K  4  6 06:30 ..
drwxr-xr-x   5 fang  admin   160B  4  6 06:30 Contents
matryer commented 3 years ago

Nice report @xfangfang. Which URL are you trying to refresh that age-ticker plugin?

xfangfang commented 3 years ago

@matryer

(jupyter369) xfangfangs-MBP:~ fang$ open -jg 'xbar://app.xbarapp.com/refreshPlugin?path=001-age-ticker.1s.py'
LSOpenURLsWithRole() failed with error -600 for the URL xbar://app.xbarapp.com/refreshPlugin?path=001-age-ticker.1s.py.
(jupyter369) xfangfangs-MBP:~ fang$ open -jg 'xbar://app.xbarapp.com/refreshPlugin?path=001-age-ticker'
LSOpenURLsWithRole() failed with error -600 for the URL xbar://app.xbarapp.com/refreshPlugin?path=001-age-ticker.
(jupyter369) xfangfangs-MBP:~ fang$ open -jg 'xbar://app.xbarapp.com/refreshPlugin?path=age-ticker.1s.py'
LSOpenURLsWithRole() failed with error -600 for the URL xbar://app.xbarapp.com/refreshPlugin?path=age-ticker.1s.py.
(jupyter369) xfangfangs-MBP:~ fang$ open -jg 'xbar://app.xbarapp.com/refreshPlugin?path=age-ticker.py'
LSOpenURLsWithRole() failed with error -600 for the URL xbar://app.xbarapp.com/refreshPlugin?path=age-ticker.py.
xfangfang commented 3 years ago

@matryer I found an interesting thing. If I close the software first, and then open -jg 'xbar://app.xbarapp.com/refreshPlugin?path=001-age-ticker.1s.py', there will be no error. However, the Xbar icon will only flash in the dock, and nothing happened. If the software has been opened, and then refresh the plugin through the terminal, it will report an error. I get more error information on another computer(MACOS 11.0.1)

FANGdeAir:679b9982232b318b fang$ open -jg 'xbar://app.xbarapp.com/refreshPlugin?path=001-age-ticker.1s.py'
The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-600 "procNotFound: no eligible process with specified descriptor" UserInfo={_LSLine=379, _LSFunction=_LSAnnotateAndSendAppleEventWithOptions}
tigger04 commented 3 years ago

I have the exact same behaviour:

~/Library/Application Support/xbar/plugins on  master
⚡23% ❯ open -jg 'xbar://app.xbarapp.com/refreshPlugin?path=autogit_status.15m.sh'
LSOpenURLsWithRole() failed with error -600 for the URL xbar://app.xbarapp.com/refreshPlugin?path=autogit_status.15m.sh.`

For every plugin:

💥~/Library/Application Support/xbar/plugins on  master
⚡23% ❯ ll
total 40
-rwxr-xr-x  1    2.7K 29 Mar 17:23 clip-hist.3s.sh*
-rwxr-xr-x@ 1    400B  4 Apr 20:53 tugbanner.1m.sh*
drwxr-xr-x  4    128B  4 Apr 20:56 purgatory/
-rwxr-xr-x@ 1    1.6K 10 Apr 07:33 weather.15m.sh*
lrwxr-xr-x  1     17B 11 Apr 06:46 autogit_status.15m.sh@ -> ../autogit_status
-rwxr-xr-x  1    1.2K 11 Apr 08:03 ansi.sh*
drwxr-xr-x  3     96B 11 Apr 09:38 hold/
-rwxr-xr-x@ 1    1.3K 11 Apr 12:30 batt-mins.10s.sh*

💥~/Library/Application Support/xbar/plugins on  master
⚡23% ❯ open -jg 'xbar://app.xbarapp.com/refreshPlugin?path=batt-mins.10s.sh'
LSOpenURLsWithRole() failed with error -600 for the URL xbar://app.xbarapp.com/refreshPlugin?path=batt-mins.10s.sh.

Without seeming to update the relevant plugin.

interestingly ...

💥~/Library/Application Support/xbar/plugins on  master
⚡23% ❯ open -a xbar
LSOpenURLsWithRole() failed for the application /Applications/xbar.app with error -600.

💥~/Library/Application Support/xbar/plugins on  master
⚡23% ❯ open /Applications/xbar.app/
LSOpenURLsWithRole() failed with error -600 for the file /Applications/xbar.app.

But in this latter case it does seem to open the application and give it focus

Now my confession:

💥~/Library/Application Support/xbar/plugins on  master
⚡21% ❯ cd ..

💥~/Library/Application Support/xbar
⚡21% ❯ ll
total 0
drwxr-xr-x  4    128B 29 Mar 17:20 cache/
lrwxr-xr-x  1     28B 29 Mar 17:22 plugins@ -> /Users/tadhg.obrien/bin/xbar

💥~/Library/Application Support/xbar
⚡21% ❯

The plugin directory is symlinked to a subdir of my custom bin folder, for the purpose of keeping it under source control and I don't like keeping my code in random hidden folders that Apple has created. Though Apple didn't create this one, in all fairness :)

I thought this might do the trick:

image

But no luck, same results

tigger04 commented 3 years ago

Update ... I thought I was coming back to make a correction that the full disk access had done the trick, but then, ...

💥~/Library/Application Support/xbar
⚡21% ❯ open-jg xbar://app.xbarapp.com/refreshPlugin\?path=batt-mins.10s.sh

💥~/Library/Application Support/xbar

crashed xbar

After starting it again manually, we're back to -600 errors

matryer commented 3 years ago

@tigger04 I don't think it's related, but I noticed an extra \ in your URL:

xbar://app.xbarapp.com/refreshPlugin\?path=batt-mins.10s.sh
                                    ^
tigger04 commented 3 years ago

Oh - I was just escaping it. You'll see in the previous examples it's within quotes and no escaping with \

Etheryte commented 3 years ago

This problem might stem from the fact that xbar is from an untrusted source. To confirm whether this is the case for you, you can run the following:

$ xattr -l /Applications/xbar.app/Contents/MacOS/xbar
com.apple.quarantine: 0000;00000000;Source;00000000-0000-0000-0000-000000000000

If there's output with com.apple.quarantine then that's the issue. You can manually remove the executable from quarantine, following which you should get no output when running the above again.

$ xattr -dr com.apple.quarantine /Applications/xbar.app/Contents/MacOS/xbar
$ xattr -l /Applications/xbar.app/Contents/MacOS/xbar
# No output

Following the above, the open call works as expected for me. The problem should go away when the executable is properly signed.

xfangfang commented 3 years ago

@Etheryte It doesn't work for me. On my MacBook(MacOS 10.15.7), running xattr -l ... output is empty, and running open -jg ... will still report an error.

What's interesting is that I had this problem on another device(MacOS 11.0.1). After updating to MacOS 11.3, the problem disappeared, but when I ran:

$ xattr -l /Applications/xbar.app/Contents/MacOS/xbar

I can get a string of output starting with com.apple.quarantine

tigger04 commented 3 years ago

This problem might stem from the fact that xbar is from an untrusted source. To confirm whether this is the case for you, you can run the following:

What's to confirm? All of the builds on the releases page, and via Homebrew, are unsigned and therefore untrusted on MacOS. The only way around this is to build it yourself from source in Xcode.

image

I don't mean to sound ungrateful to the creator and maintainers who have put so much time and effort in to this wonderful tool, but the rebrand to xbar and decision to rewrite it from scratch has obviouly been a failure since there are a plethora of regression defects that make this pretty much un-usable now. This in itself would not be a problem if it was maintained, but as it's now 3 months since the last release I think it's safe to assume it is not.

mlcampbe commented 3 years ago

Anyone ever solve this problem as I am running into it as well.

I will note that the problem only occurs if I start xbar by double clicking the icon and then trying to run 'open open -jg 'xbar://app.xbarapp.com/refreshAllPlugins' from a terminal window. But, from a terminal window if I start xbar by running /Applications/xbar.app/Contents/MacOs/xbar it runs successfully and then in a separate terminal window the above open command works as expected with no errors.

dougpagani commented 2 years ago

Can confirm for me as well that starting it through terminal is the only way to get the URL-scheme functionality to work.