Skip to content

Commit

Permalink
Fix hang in ext/POSIX/t/sysconf.t on GNU/Hurd
Browse files Browse the repository at this point in the history
while compiling perl 5.14.2 on GNU/Hurd, I ran into what it seems a
undefined POSIX behaviour in ext/POSIX/t/sysconf.t.

      my $fd = POSIX::open($fifo, O_RDWR)
      or skip("could not open $fifo ($!)", 3 * @path_consts_fifo);

according to the POSIX open()[1] about O_RDWR,
  The result is undefined if this flag is applied to a FIFO.
.... which is actually our case.
Apparently Linux and *FreeBSD (and maybe also OSes) accept this
behaviour, but on GNU/Hurd this causes the open() call to block
undefinitely. Given there's nothing done with the FIFO if not querying
{,f}pathconf() values, the proposed solution I attached is to change
the opening mode to "O_RDONLY | O_NONBLOCK".

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html
  • Loading branch information
Pino Toscano authored and nwc10 committed Nov 4, 2011
1 parent 5a0c33f commit 8040185
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ext/POSIX/t/sysconf.t
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ SKIP: {
or skip("could not create fifo $fifo ($!)", 2 * 3 * @path_consts_fifo);

SKIP: {
my $fd = POSIX::open($fifo, O_RDWR)
my $fd = POSIX::open($fifo, O_RDONLY | O_NONBLOCK)
or skip("could not open $fifo ($!)", 3 * @path_consts_fifo);

for my $constant (@path_consts_fifo) {
Expand Down

0 comments on commit 8040185

Please sign in to comment.