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

Willy Raets willy at ...2734...
Tue Apr 2 22:33:57 CEST 2013


It is getting more crazy by the minute:

This is part of the code of previous version posted (version 0.0.5):

Public Sub btnSudo_Click()

  If IsNull(txtPassword.Text) Then
    Message.Info("First enter a password")
  Else
    txaOutput.Clear
    txaOutput.Text = "Ready to rumble..\n\n"
    $hProcess = Exec [System.Shell, "-c", "sudo -s id -u"] For Input
Output As "Process"
    Print #$hProcess, txtPassword.Text
  Endif
  
End

To pin point where it goes wrong I added a output to txaOutput
(TextArea) before and after the passing of the password.
See ExpectedOutcome.png for what is should show when run successfully.

Changed the code to (version 0.0.6):

Public Sub btnSudo_Click()

  If IsNull(txtPassword.Text) Then
    Message.Info("First enter a password")
  Else
    txaOutput.Clear
    txaOutput.Text = "Ready to rumble..\n"
    $hProcess = Exec [System.Shell, "-c", "sudo -s id -u"] For Input
Output As "Process"
    txaOutput.Text &= "Passing password..\n"   '<-- ADDED
    Print #$hProcess, txtPassword.Text
    txaOutput.Text &= "Password passed..\n\n"  '<-- ADDED
  Endif
  
End

Attached the source code archive version 0.0.6

Next tested this on my Gambas 3.3.4 running distributions. Note the
difference
Test results version 0.0.5 (see previous post):
GAMBAS 3.3.4
------------
1. Linux Mint 13 - Mate 1.4.0 - sudo version: 1.8.3p1 (Ubuntu 12.04
based)
run 1 -> ok				run 1 -> ok
run 2 -> ok				run 2 -> ok
run 3 -> ok				run 3 -> ok
run 4 -> ok				run 4 -> ok
run 5 -> ok				run 5 -> ok

2. Lubuntu 12.04 - LXDE 0.5.8 - sudo version: 1.8.3p1 (Ubuntu 12.04
based)
run 1 -> hang!!				run 1 -> ok
run 2 -> hang!!				run 2 -> hang!!
run 3 -> hang!!				run 3 -> hang!!
run 4 -> hang!!				run 4 -> hang!!
run 5 -> hang!!				run 5 -> hang!!

3. Linux Mint 13 - Xfce 4.10 - sudo version: 1.8.3p1 (Ubuntu 12.04
based)
run 1 -> hang!!				run 1 -> hang!!
run 2 -> ok				run 2 -> hang!!
run 3 -> hang!!				run 3 -> hang!!
run 4 -> hang!!				run 4 -> hang!!
run 5 -> ok				run 5 -> hang!!

Test results version 0.0.6 (see attachement)
GAMBAS 3.3.4
------------
1. Linux Mint 13 - Mate 1.4.0 - sudo version: 1.8.3p1 (Ubuntu 12.04
based)
run 1 -> ok				run 1 -> ok
run 2 -> ok				run 2 -> ok
run 3 -> ok				run 3 -> ok
run 4 -> ok				run 4 -> ok
run 5 -> ok				run 5 -> ok

2. Lubuntu 12.04 - LXDE 0.5.8 - sudo version: 1.8.3p1 (Ubuntu 12.04
based)
run 1 -> ok				run 1 -> ok
run 2 -> ok				run 2 -> ok
run 3 -> ok				run 3 -> ok
run 4 -> ok				run 4 -> ok
run 5 -> ok				run 5 -> ok

3. Linux Mint 13 - Xfce 4.10 - sudo version: 1.8.3p1 (Ubuntu 12.04
based)
run 1 -> ok				run 1 -> ok
run 2 -> ok				run 2 -> ok
run 3 -> ok				run 3 -> ok
run 4 -> ok				run 4 -> ok
run 5 -> ok				run 5 -> ok

Will be testing further, but there is improvement as all seems to work
now all of a sudden just by adding two lines of code to check what is
happening, Xfce and LXDE seem to be doing fine....??!!

Anyone who can make some sense out of this? Explain what is happening
and why?

I'll be back with a Gambas 3.4.0 report later...wonder what happens
there..


-- 
Kind regards,

Willy (aka gbWilly)

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



-------------- next part --------------
A non-text attachment was scrubbed...
Name: ExpectedOutcome.png
Type: image/png
Size: 9173 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20130402/3961279b/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gsudo-0.0.6.tar.gz
Type: application/x-compressed-tar
Size: 6379 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20130402/3961279b/attachment.bin>


More information about the User mailing list