[Gambas-user] Strange problem with running Shell on Fedora (code works in IDE but not in executable!!)

Willy Raets willy at ...2734...
Sun Mar 31 13:48:17 CEST 2013


On Sat, 2013-03-30 at 15:35 +0100, Willy Raets wrote:
> On Sat, 2013-03-30 at 15:21 +0100, Benoît Minisini wrote:
> > Le 30/03/2013 15:18, Willy Raets a écrit :
> > > On Sat, 2013-03-30 at 13:14 +0100, Tobias Boege wrote:
> > >> On Sat, 30 Mar 2013, Beno?t Minisini wrote:
> > >>> Le 30/03/2013 12:11, Tobias Boege a ?crit :
> > >>>> On Sat, 30 Mar 2013, Tobias Boege wrote:
> > >>>>> Hmm. I have sudo-1.8.6p7 in use (more accurately, the error comes from the
> > >>>>> 'sudoers' plugin but it has the same version here) on Arch Linux and, as I
> > >>>>> said, my test program works.
> > >>>>>
> > >>>>> Well, I had another look at the source code and it seems that there's a
> > >>>>> certain variable 'def_requiretty' which is zero in my system's package and
> > >>>>> prevents checking /dev/tty at all. This finally explains why all test cases
> > >>>>> worked on my system even though there was no /dev/tty accessible from
> > >>>>> Desktop. See sudoers(5) for a description and how to deactivate this in the
> > >>>>> sudoers configuration.
> > >>>>>
> > >>>>> Since editing user configurations to make programs work is often not
> > >>>>> desirable, I experimented with a patched sudo that requires the tty et
> > >>>>> voila! Got the same error as yours when running from desktop. However, now
> > >>>>> I can't solve it either :-)
> > >>>>>
> > >>>>> I'll start another thread to attract Benoit's attention again...
> > >>>>>
> > >>>>
> > >>>> Hmm, nevermind. You can use the Exec instruction to get it to work:
> > >>>>
> > >>>> hProcess = Exec ["sudo", "-s", "id", "-u" ] For Input Output As "Process"
> > >>>>
> > >>>> This is how the IDE does it and as you mentioned, the IDE gets it correctly.
> > >>>> Maybe someone can enlighten us why it doesn't work with Shell but it's not
> > >>>> that important to me.
> > >>>>
> > >>>> Regards,
> > >>>> Tobi
> > >>>>
> > >>>
> > >>> SHELL "a b c" ...
> > >>>
> > >>> is equivalent to:
> > >>>
> > >>> EXEC [ System.Shell, "-c", "a b c" ]
> > >>>
> > >>> with a call to setpgid(0,0) to create its own session like an
> > >>> independant shell.
> > >>>
> > >>> As for virtual terminal creation, they work both the same.
> > >>>
> > >>> - "For Input Output" => create a virtual terminal for the i/o of the
> > >>> child process, and get the i/o of the child process through it.
> > >>>
> > >>> - "For Read Write" => Just redirect the i/o of the child process to get
> > >>> them in the parent process.
> > >>>
> > >>> Can you try to replace "SHELL ..." by "EXEC [ System.Shell, "-c", ... ]"
> > >>> and tell me if it works better?
> > >>>
> > >>
> > >> Exec [System.Shell, "-c", "sudo -s id -u"] For Input Output
> > >>
> > >> It works!
> > >
> > > NOT on the Fedora 17 - LXDE 0.5.12 - Gambas 3.4.0 when run from
> > > executable. Same error again
> > >
> > > Screen01.png -> Running executable with error message
> > > Screen02.png -> changed code using Exec [System.Shell .....]
> > >
> > > Somehow it is impossible to use sudo on the Fedora box from Gambas
> > > executable.
> > > Although all works when done directly in terminal by hand or when done
> > > from Gambas 3 app run in IDE. The Gambas 3 executables just refuse to
> > > work...
> > >
> > > On my Linux Mint 13 all works just fine.
> > >
> > 
> > Sorry, but you must use "For Input Output", not "For Read Write".
> 
> Well I used Read Write because when replacing Read Write with Input
> Output the application does nothing but keep the system busy!!

The not doing anything mentioned above is only when run from IDE on
Fedora. On other distro's no problem at all when running from IDE

I can confirm that the:
Exec [System.Shell, "-c", "sudo -s id -u"] For Input Output
now works on Fedora from executable. 
So now I'll implement this manner of executing a Shell in my application
and see if all works there as well

Tobi, Benoît, Thanks...

-- 
Kind regards,

Willy (aka gbWilly)

http://gambasshowcase.org/
http://howtogambas.org
http://gambos.org








More information about the User mailing list