Hi
Please tell me if you need anything else!
I've found some more stuff:
This we already know:
> $ ruby1.8 -rpty -e 'so, si, pid = PTY.spawn("/bin/true"); '
> -e:1:in `spawn': No such file or directory - can't get Master/Slave device (Errno::ENOENT)
> from -e:1
But what happens if we add something before the call to PTY.spawn()
> $ ruby1.8 -rpty -e 'puts "blub"; so, si, pid = PTY.spawn("/bin/true"); '
> blub
> -e:1: [BUG] rb_sys_fail(can't get Master/Slave device) - errno == 0
> ruby 1.8.4 (2005-12-24) [sparc-solaris2.8]
>
> Abort
Oops? Different error? (Nobus patch is applied on this machine).
The following message in the truss log was another thing that bothered me:
> 26811: execve("/usr/lib/pt_chmod", 0xFFBEE340, 0xFFBEFAC8)
> 26811: *** cannot trace across exec() of /usr/lib/pt_chmod ***
Eventually I tried to run the process with user rights and then truss it with root rights:
> $ ruby1.8 -rpty -e 'puts $$; readline; so, si, pid = PTY.spawn("/bin/true"); '
19467
[ here I started a second terminal and attached a truss, which is
running as root, hen I pressed enter ]
>
> -e:1: [BUG] rb_sys_fail(can't get Master/Slave device) - errno == 0
> ruby 1.8.4 (2005-12-24) [sparc-solaris2.8]
>
> Abort
This root-truss covers now everything and it's attached to this email as 'pty-spawn-problem.truss'.
Then I tried soemthing else, I run the whole ruby process as root:
> $ sudo ruby1.8 -rpty -e 'puts $$; so, si, pid = PTY.spawn("/bin/true"); '
> 20320
Hm, this works now. So perhaps it's a permission problem. Afterwards I
tried to run a command which produces output:
> $ sudo ruby1.8 -rpty -e 'puts $$; so, si, pid = PTY.spawn("uptime"); puts so.read;'
> 20351
No output. Lets try it with sysread:
> $ sudo ruby1.8 -rpty -e 'puts $$; so, si, pid = PTY.spawn("uptime"); puts so.sysread(1024);'
> 20361
> -e:1:in `sysread': end of file reached (EOFError)
> from -e:1
Nothing... perhaps it has to do with the fact that uptime imediatly quits (my
linux boxes produces sometimes an exception before I can read the output)
> $ sudo ruby1.8 -rpty -e 'puts $$; so, si, pid = PTY.spawn("ssh testsite1"); puts so.sysread(1024);'
> 20603
> -e:1:in `sysread': end of file reached (EOFError)
> from -e:1
Same here.. 
I really don't get it.. im completly out of ideas...
Please tell me if you need anything else.
Regards,
Reto Schüttel
pty-spawn-problem.truss (8.88 KB)
···
On Tue, Apr 18, 2006 at 06:15:14PM +0900, Reto Schuettel wrote: