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

Tobias Boege taboege at ...626...
Sat Mar 30 11:49:28 CET 2013


On Sat, 30 Mar 2013, Willy Raets wrote:
> On Wed, 2013-03-27 at 20:14 +0100, Tobias Boege wrote:
> > On Wed, 27 Mar 2013, Willy Raets wrote:
> > > Okay, got what you meant.
> > > I implemented for read write and send password using priny right after
> > > the shell call.
> > > In IDE all still works as before
> > > In Executable same error message as before:
> > > 'sudo: sorry, you must have a tty to run sudo'
> > > 
> > > Any other suggestions?
> > 
> > I'm attaching a minimal project that *does* work on my system. My test cases
> > were:
> > 
> > | Run from | Using "For Read Write" | Using "For Input Output" |
> > | IDE      |           OK           |            OK            |
> > | Terminal |           OK           |            OK            |
> > | Desktop  |           OK           |            OK            |
> > 
> > so I always got root and my assumption with the pty was wrong. This is good
> > news - although I don't understand it. I never got your tty error...
> > 
> > So I wrote a program to open /dev/tty as sudo does, according to my sudo
> > sources. This program _failed_ when run via double-click from desktop - as I
> > expected. How strange that sudo didn't complain then, I have no idea about
> > why this worked above... But I don't really have the desire to find it out.
> > 
> > BTW, my sudo (and source I'm staring at) is sudo-1.8.6p7.
> > 
> > Since your project does not work, it is either a system issue (what's your
> > sudo version?) or in another part of your program (the hProcess1.Wait()
> > looks strange - at least, I never used that method). Could you try the
> > attached project so that we can throw away the "system issue" idea (or not)?
> > 
> > So, if my project works for you, experiment with it to get yours working.
> > 
> > Regards,
> > Tobi
> 
> Okay Tobi,
> 
> I finally had time to get this tested.
> 
> I first run it on my LinuxMint 13 - Mate 1.4.0 - Gambas 3.3.4
> - runs in IDE
> - runs from executable
> 
> sudo-1.8.3p1
> 
> Next I run it on Fedora 17 - LXDE 0.8.12 - Gambas 3.4.0
> - runs in IDE (see SudoIDE.png)
> - Error in executable (see Sudo.png)
> 
> sudo-1.8.6p7
> 
> So, is this a Gambas shell problem in combination with certain
> circumstances present on the system or sudo related?
> 
> I'll test on some more distros later and report back any discoveries.

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...

Regards,
Tobi




More information about the User mailing list