[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Problems with PERL 5.10 and system pipe



-=| gregor herrmann, Thu, Sep 24, 2009 at 01:50:18PM +0200 |=-
> On Thu, 24 Sep 2009 14:13:24 +0300, Damyan Ivanov wrote:
> 
> > > May be smb know what the problem? Or it's a bug in a perl package?
> > The same thing happens with the following simple test C program:
> 
> Yup, same in bash:
> 
> Terminal 1:
> gregoa@colleen:~$ mkfifo /tmp/fifo
> gregoa@colleen:~$ cat /tmp/fifo
> 
> <hangs until ...> 

Technically, 'cat' is 'open' + 'read', which is normal to block until 
some input appears.

> > So the problem seems to be global, not specific to perl. Perhaps 
> > the kernel has changed the way the pipes are opened?
> 
> /me vaguely remembers something about non-blocking open()s ..
> 
> gregoa@colleen:~$ perl -MFcntl -e 'sysopen(PH, "/tmp/fifo", O_NONBLOCK)'
> gregoa@colleen:~$ 
> 
> Works :)

But is the file handle returned ready to be read from?

  $ perl -MFcntl -we 'use autodie; use strict; sysopen(PH, "test", 
  O_NONBLOCK); print readline(PH)'
  $

(i.e. no hang even on reads)
And this doesn't read from the pipe even if I do "echo some > test" 
beforehand. Something is not right.

-- 
dam

Attachment: signature.asc
Description: Digital signature


Reply to: