[Gambas-user] Running Sudo using Exec acts very differently from distro to distro!!

Bruce bbruen at ...2308...
Wed Apr 3 03:30:38 CEST 2013


On Tue, 2013-04-02 at 18:54 +0200, Willy Raets wrote:
8<
> For example why am I getting different results running:
> sudo -s id -u
> on some systems for every time I run it (without any changes to code at
> all)?
> 
> Attached gsudo.png shows the desired result (just for testing sudo)
> 
> Been playing and testing this for over 12 hours in total last few days
> and whatever I do nothing seems to work on all systems.
> 
> Code run (see attached source archive):
> 
> Tested this on a bunch of distro desktop combinations running from both
> IDE and gambas executable:
> 
> Added is my results and I'm stunned by them as to me they make no sense
> at all!!
> 
> 1. Code seems to work all the time on all Ubuntu based distros except
> those running LXDE, Xfce and RazorQt
> 2. Code doesn't seem to work (or not all the time) on LXDE, Xfce
> desktops no matter what distro
> 3. Code doesn't seem to work (or not all the time) on Debian
> 
8<

Hi Willy,

Yes, sudu is very different on different distros!  Completely different
in fact.  The last time I counted (about a year ago), there were 5
different versions over the dozen or so distros we support.  These
differences lie in the absolute base code.  That is, they are actually
completely different programs not different versions of the same base
code.

So much for the bad news.

The best answer we have found is to use gksu.  This separates the
privilege escalation from the actual execution stream, but note that the
user has to enter the privilege escalation password every time it is
invoked (which some consider to be "not a bad thing").  Since deciding
on that route, it has worked "almost" seamlessly on all our client's
distros with little support effort. I say "almost" because there is
something about older versions of ubunti that corrupt the use of su
(which is what gksu uses to initiate the execution thread).

gksu appears to us to be fairly desktop agnostic (within reason). gsudo
and its' (dare I say) inbred cousins don't seem to be so.

Since adopting that model, i.e. separating the privilege escalation from
the execution stream, we have had very few "help me" support calls for
the dozens of gambas Shell and Execute calls our stuff makes.

Also and without wanting to get into the age old su vs. sudo battle! I
just want to say one thing. At least su based utilities ....
(Oh bugger, that's just going to start it all again.)
Suffice to say, guess which side I'm on.

and finally, "gksu" - it works for me!

hth
Bruce






More information about the User mailing list