|
|
| Next: Bug#547301: [patch] Bug#547301: problems with htt.. |
| Author |
Message |
user External

Since: Sep 24, 2009 Posts: 1
|
Posted: Thu Sep 24, 2009 6:10 am Post subject: Problems with PERL 5.10 and system pipe Archived from groups: linux>debian>maint>perl (more info?) |
|
|
Hi all!
There was a server with Debian Etch 32 bit, PERL version - 5.8.8, and a
script on perl, which opened a system pipe like this:
open (PH,"/dev/squid");
The pipe is creating like this : mkfifo /dev/squid
After all, a new server was installed, with Debian Lenny 64 bit, Perl
version - 5.10.0, and now perl doesn't open the pipe. I.e. after that
stroke it doesn't go further, just freezing.
Permissions and paths are ok.
May be smb know what the problem? Or it's a bug in a perl package?
--
To UNSUBSCRIBE, email to debian-perl-REQUEST.RemoveThis@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster.RemoveThis@lists.debian.org |
|
| Back to top |
|
 |
gregor herrmann External

Since: Mar 11, 2009 Posts: 38
|
Posted: Thu Sep 24, 2009 9:10 am Post subject: Re: Problems with PERL 5.10 and system pipe [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
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 ...>
Terminal 2:
gregoa@colleen:~$ echo foo > /tmp/fifo
gregoa@colleen:~$
<... now in terminal 1>
foo
gregoa@colleen:~$
> 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
Cheers,
gregor
--
.''`. http://info.comodo.priv.at/ -- GPG Key IDs: 0x00F3CFE4, 0x8649AA06
: :' : Debian GNU/Linux user, admin, & developer - http://www.debian.org/
`. `' Member of VIBE!AT, SPI Inc., fellow of FSFE | http://got.to/quote/
`- "Rome wasn't burned in a day. "
--
To UNSUBSCRIBE, email to debian-perl-REQUEST.TakeThisOut@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster.TakeThisOut@lists.debian.org |
|
| Back to top |
|
 |
gregor herrmann External

Since: Mar 11, 2009 Posts: 38
|
Posted: Thu Sep 24, 2009 11:10 am Post subject: Re: Problems with PERL 5.10 and system pipe [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
On Thu, 24 Sep 2009 15:58:30 +0300, Damyan Ivanov wrote:
> > gregoa@colleen:~$ perl -MFcntl -e 'sysopen(PH, "/tmp/fifo", O_NONBLOCK)'
> > gregoa@colleen:~$
> 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.
Right, it seems to read if something's written to the pipe at the
moment of reading.
Terminal 1:
gregoa@colleen:~$ while :; do echo bla > /tmp/fifo ; sleep 1 ; done
Terminal 2:
gregoa@colleen:~$ perl -MFcntl -e 'sysopen(PH, "/tmp/fifo", O_NONBLOCK); print readline(PH)'
Sometimes echos 'bla' and sometimes not.
Hm, somethings missing in the puzzle.
Cheers,
gregor
--
.''`. http://info.comodo.priv.at/ -- GPG Key IDs: 0x00F3CFE4, 0x8649AA06
: :' : Debian GNU/Linux user, admin, & developer - http://www.debian.org/
`. `' Member of VIBE!AT, SPI Inc., fellow of FSFE | http://got.to/quote/
`- A woman should have compassion. -- Kirk, "Catspaw", stardate 3018.2
--
To UNSUBSCRIBE, email to debian-perl-REQUEST.DeleteThis@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster.DeleteThis@lists.debian.org |
|
| Back to top |
|
 |
Alex Muntada External

Since: Sep 25, 2009 Posts: 1
|
Posted: Fri Sep 25, 2009 11:10 am Post subject: Re: Problems with PERL 5.10 and system pipe [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
+ Damyan Ivanov <dmn RemoveThis @debian.org>:
> (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.
O_NONBLOCK means non-blocking I/O at all, even for read.
This works as expected:
$ perl -MFcntl -we 'use autodie; use strict; sysopen(PH, "test",
O_NONBLOCK); while (1) { print readline(PH); sleep 1 }'
And afterwards:
$ echo foobar > test
HTH
--
Alex Muntada <alexm RemoveThis @alexm.org>
http://alexm.org/
--
To UNSUBSCRIBE, email to debian-perl-REQUEST RemoveThis @lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster RemoveThis @lists.debian.org |
|
| Back to top |
|
 |
Vincent Danjean External

Since: Aug 29, 2006 Posts: 10
|
Posted: Wed Sep 30, 2009 2:10 pm Post subject: Re: Problems with PERL 5.10 and system pipe [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Alex Muntada wrote:
> + Damyan Ivanov <dmn.RemoveThis@debian.org>:
>
>> (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.
>
> O_NONBLOCK means non-blocking I/O at all, even for read.
>
> This works as expected:
>
> $ perl -MFcntl -we 'use autodie; use strict; sysopen(PH, "test",
> O_NONBLOCK); while (1) { print readline(PH); sleep 1 }'
You should also be able to remove the NONBLOCK after the open
(fnct() with the F_SETFL command in C, it probably exists a binding in perl)
The blocking opening of a fifo is a standard behavior and documented:
man fifo
[...] The FIFO must be opened on
both ends (reading and writing) before data can be passed. Normally,
opening the FIFO blocks until the other end is opened also.
A process can open a FIFO in non-blocking mode. In this case, opening
for read only will succeed even if no-one has opened on the write side
yet, opening for write only will fail with ENXIO (no such device or
address) unless the other end has already been opened.
[...]
Regards,
Vincent
> And afterwards:
>
> $ echo foobar > test
>
> HTH
>
--
Vincent Danjean GPG key ID 0x9D025E87 vdanjean.RemoveThis@debian.org
GPG key fingerprint: FC95 08A6 854D DB48 4B9A 8A94 0BF7 7867 9D02 5E87
Unofficial pacakges: http://moais.imag.fr/membres/vincent.danjean/deb.html
APT repo: deb http://perso.debian.org/~vdanjean/debian unstable main
--
To UNSUBSCRIBE, email to debian-perl-REQUEST.RemoveThis@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster.RemoveThis@lists.debian.org |
|
| Back to top |
|
 |
|
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
| |
|
|