| 
     
      
      
      From: Andre G. <abg...@uw...> - 2001-02-23 14:50:28
      
     
   | 
On Fri, Feb 23, 2001 at 10:23:12AM +0100, Olivier Chapuis wrote:
> Andre Goeree wrote:
> > 
> > ----- Forwarded message from Andre Goeree <abg...@uw...> -----
> > 
> > Subject: Re: No more FvwmScript-ThemesCenter: exit!
> > From: Andre Goeree <abg...@uw...>
> > To: Olivier Chapuis <oli...@fr...>
> > Date: Thu, 22 Feb 2001 20:37:52 +0100
> > 
> > On Thu, Feb 22, 2001 at 04:30:29PM +0100, Olivier Chapuis wrote:
> > >
> > > First experience: start one of the above FvwmScript. You should
> > > see a .tpm-com-lock-"script_name"-pidnum pipe. Can you check if
> > > the pidnum is good: is this pidnum the pid of the FvwmScript you
> > > start?
> > > If no we have found the bug and you do not need to do the second
> > > experience.
> > 
> > I believe we have found it :-)
> >
> 
> Yes
Good! :-)
>  
> > ago@mandark$ ls -a ~/.fvwm/.tmp-com-*
> > .tmp-com-lock-script-16049
> > 
> > And "ps" gives:
> > 16047 /home/ago/sys/fvwm/libexec/fvwm/2.3.29/FvwmScript ...
> > 
> 
> The commands use by the FvwmScript scripts to found the pid
> is:
> 
>    Set $cmd = {perl -e '$t=getppid; print $t . "\n"'}
>    Set $pid = (GetOutput $cmd 1 -1)
> 
> FvwmScript use popen (and fread) to get the output.
> It seems that on Andre machine the following happen:
> 
>    FvwmScript -> a shell run by popen -> perl cmd
> 
Yes, this appears to be the case, from the popen(3) man page:
DESCRIPTION
     The popen() function ``opens'' a process by creating a bidirectional pipe
     forking, and invoking the shell.  Any streams opened by previous popen()
     calls in the parent process are closed in the new child process.  Histor-
     ically, popen() was implemented with a unidirectional pipe; hence many
     implementations of popen() only allow the type argument to specify read-
     ing or writing, not both.  Since popen() is now implemented using a bidi-
     rectional pipe, the type argument may request a bidirectional data flow.
     The type argument is a pointer to a null-terminated string which must be
     `r' for reading, `w' for writing, or `r+' for reading and writing.
     The command argument is a pointer to a null-terminated string containing
     a shell command line.  This command is passed to /bin/sh using the -c
     flag; interpretation, if any, is performed by the shell.
There you have it :-)
> so the $pid is the pid a of shell run by popen. However,
> on our Linux machine the shell is hidden so perl return
> the "correct" parent pid. The problem can came from a lot
> of place:
> - the libc (Andre what is your(/bsd) libc?)
libc version 4.0
> - perl implementation
perl 5.005_3, not threaded, no suidperl.
> - os process implementation
> Really no idea.
I searched the system docs for the subject but could 
not find anything appropriate yet... 
> Mikhael do you have an idea to fix this? We can go back
> to the ps command and try to use it in a POSFIX way (or
> use some "if (linux) then ... else if (bds) ...").
> 
> I've done a Test FvwmScript attached to this message,
> to do some tests. Andre can you run it. On my machine
> the first two pid are the FvwmScript pid and the 3rd
> is the init pid (1). There are almost no hope that the
> second pid  number will solve our problems.
Hmm, i'm afraid that you have to give some instructions
on how to run the script. I'm not that up to date on the
matter yet..
Regards,
Andre
 |