Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Perl: porters

[perl #40190] Solaris: BEGIN and exec, fork, system or open(|-,-|)

 

 

Perl porters RSS feed   Index | Next | Previous | View Threaded


perlbug-followup at perl

Apr 27, 2012, 8:55 AM

Post #1 of 1 (73 views)
Permalink
[perl #40190] Solaris: BEGIN and exec, fork, system or open(|-,-|)

On Sun Aug 20 12:02:54 2006, nicholas wrote:
> On Sun, Aug 20, 2006 at 07:47:34PM +0100, Nicholas Clark wrote:
>
> > Most strange. truss shows that all the writes are in the parent:
> >
> > 1609: write(1, " P A R E N T : C H E C".., 15) = 15
> > 1609: write(1, " P A R E N T : C H E C".., 15) = 15
> > 1609: write(1, " P A R E N T : I N I T".., 13) = 13
> > 1609: write(1, " P A R E N T : I N I T".., 13) = 13
> > 1609: write(1, " P A R E N T : t h a t".., 13) = 13
> > 1609: write(1, " 0\n", 2) = 2
> > 1609: write(1, " P A R E N T : t h a t".., 13) = 13
> > 1609: write(1, " 0\n", 2) = 2
> >
> > So it's nothing as obvious as the child process failing to _exit()
at the
> > appropriate time.
>
> B::Deparse shows that most of the program is duplicated. I think it's an
> interaction between fork() and the file position on the descriptor used to
> read the program. I can't remember exactly what the Solaris behaviour is,
> but there's something it does differently from most other operating
systems,
> I think at child exit, where it seeks file descriptors. Hopefully someone
> else can fill me in.
>
> But what's happening is that the after the child exits, the underlying
Unix
> file descriptor that the interpreter is reading the program from has its
> position moved back, because that descriptor was shared with the child.
> The interpreter first reads all the buffered data, so you get the program
> compiled once. When the buffer is empty, it is refilled from the
underlying
> descriptor, which "should" have been at EOF, but now isn't. So parts of
> the program get read again.
>
> I say "should" because I can't remember whose "fault" all this emergent
> behaviour is. It was discussed previously (in another context)
>
> Nicholas Clark
>

This is still present in 5.14.2 and blead.


---
via perlbug: queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=40190

Perl porters RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.