Bug 1059 - The strangeness of executing "xdg-open" in the terminal emulator
The strangeness of executing "xdg-open" in the terminal emulator
Status: NEW
Product: Sudo
Classification: Unclassified
Component: Sudo
1.9.14
PC Linux
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2023-10-09 12:17 MDT by Sergey
Modified: 2023-10-09 12:17 MDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey 2023-10-09 12:17:45 MDT
Linux Debian-64 12.0
Desktop XFCE4 4.18.
sudo 1.9.14p2

Faced with an interesting oddity.
u1 is a user with normal rights.
1.txt — a text file with any content.

If you enter a simple command in the terminal emulator window with root rights:
sudo -u u1 xdg-open 1.txt

the number of times we enter this command in this terminal, the number of times the file will be opened "1.txt " in separate windows.

If you enter a simple command in the terminal emulator window with the rights of a regular user:
xdg-open 1.txt

then, no matter how many times you enter this command in this terminal, the file "1.txt " will only be opened in one window once.

If Firefox or Librewolf is installed as the "default-web-browser", then
if in the terminal emulator window with root rights instead of "1.txt " to open some URL, then the "default-web-browser" will be launched with the rights of a regular user with the opening of the specified URL, if before that "default-web-browser" was not started. And if it was, then when you restart the "default-web-browser", a message will be displayed :

Firefox is already running, but is not responding. To use Firefox, you must first close the existing Firefox process, restart your device, or use a different profile.

If, in the absence of launching "default-web-browser", when the command
sudo -u u1 xdg-open something_url is launched in the terminal emulator window with root rights
, "default-web-browser" is launched with something_url open, then in the terminal emulator window with normal user rights after running the command :
xdg-open something_url

after an attempt by the command to implicitly launch "default-web-browser", a message will be displayed :
JavaScript error: resource://gre/modules/XULStore.sys.mjs, line 60: Error: Can't find profile directory.
JavaScript error: resource://gre/modules/XULStore.sys.mjs, line 60: Error: Can't find profile directory.
JavaScript error: resource://gre/modules/XULStore.sys.mjs, line 60: Error: Can't find profile directory.
JavaScript error: resource://gre/modules/XULStore.sys.mjs, line 60: Error: Can't find profile directory.
JavaScript error: resource://gre/modules/XULStore.sys.mjs, line 60: Error: Can't find profile directory.

I have not tried with other web browsers, due to their absence.
Maybe this happens in other Linux systems as well.

In particular, this is manifested in the inability to view the "home" URL for any package in Synaptic if the "default-web-browser" was launched before that.