[Gambas-user] [Gambas Bug Tracker] Bug #973: Desktop.RunAsRoot(): file or directory doesn't exist
bugtracker at ...3416...
bugtracker at ...3416...
Sat Aug 6 18:34:07 CEST 2016
http://gambaswiki.org/bugtracker/edit?object=BUG.973&from=L21haW4-
Comment #6 by Bruce BRUEN:
OK. Firstly, regarding the RunAsRoot() problem.
This is not a gambas "bug" per-se. The problem is that the file "xdg-su" is missing from the xdg-utils directory in the gb.Desktop project directory (i.e. the Data/xdg-utils directory in the IDE). Now, why this is missing is a complex issue and what the correct solution is, is even more so.
xdg-su is a bash script that attempts to determine the correct method for invoking a privileged command (or more correctly, invoking a command with admin privileges). Unfortunately it uses an internal and very outdated means of determining that method by way of finding which desktop environment is active. In other words "if I know which DE is in use therefore the correct utility to invoke is ...". Wrong! Even further, the script as it is can only detect "KDE" or "GNOME" or "xfce". (Which was fine back in 2006!)
Looking at the current xdg-utils web page https://www.freedesktop.org/wiki/Software/xdg-utils/ I find that, wonder of wonders, xdg-su no longer exists. The git repository does have an xdg-su script, but at face value that is incompatible with the version used by the gambas gb.Desktop component (it requires xdg-common).
The final problem is that the desktop is no longer an indicator for determining the "correct" privilege escalation method. In fact, I have at least 3 ways of achieving it on my pc - all of which work, more or less :-) - to my mind it is a user preference thing, not a desktop thing. For example, if I know I'm going to be installing a gambas program lots of times in a session, then I use gksu, which has the remarkable ability to remember the root password for the duration of the session. Dangerous? Maybe but it works for me in that situation. On the other hand, if I'm doing something really dangerous, I'll simply use "su" in a terminal.
So how do we fix this? Do we continue to use the xdg-su approach, write a gambas specific solution or something else? My initial gut feeling is that a gambas solution is the best in the long term.
Now, secondly - the OpenTerminal issue is a separate bug entirely. Ru - please raise it accordingly. But before you do, review your usage of the command - the optional function parameter is the "directory where the terminal will open", so Desktop.OpenTerminal("/etc") opens a terminal with the working directory set to "/etc". You cannot prescribe the terminal emulator. Having said that, there is a bug if it is not figuring out what your default terminal emulator is and thus it is falling through to a default of "mate-terminal" or it is detecting your desktop correctly but the terminal emulator program name is wrong.
More information about the User
mailing list