On Thu, Jun 9, 2011 at 11:44 AM, Bruno Haible <br...@clisp.org> wrote: > On HP-UX 11.31, I'm seeing this test failure: > > test-spawn-pipe-child.c:99: assertion failed > test-spawn-pipe.sh: iteration 4 failed > test-spawn-pipe-child.c:99: assertion failed > test-spawn-pipe.sh: iteration 5 failed > test-spawn-pipe-child.c:99: assertion failed > test-spawn-pipe.sh: iteration 6 failed > test-spawn-pipe-child.c:99: assertion failed > test-spawn-pipe.sh: iteration 7 failed > FAIL: test-spawn-pipe.sh > > Apparently, although fd 2 was closed in the parent process, it is open again > in the child process. This must happen in the exec* calls, since posix_spawn > from gnulib is used (HP-UX does not have posix_spawn) and the code works fine > on other platforms. For debugging, I added an fstat call and found the inode > number of the file is the same as the inode number of /dev/null. So it looks > very much like HP-UX exec* is assigning a /dev/null file descriptor when it > finds a closed file descriptor in position 2. I don't know how to avoid this.
LDPRELOAD a fixup ? > So let's just skip this part of the test: > > > 2011-06-09 Bruno Haible <br...@clisp.org> > > spawn-pipe tests: Avoid test failure on HP-UX 11. > * tests/test-spawn-pipe-child.c (main) [HP-UX]: Don't assert that fd 2 > is closed. > > --- tests/test-spawn-pipe-child.c.orig Thu Jun 9 11:35:54 2011 > +++ tests/test-spawn-pipe-child.c Wed Jun 8 22:19:09 2011 > @@ -95,8 +95,12 @@ > ASSERT (is_open (STDERR_FILENO)); > break; > case 1: > - /* Expect fd 2 is closed. */ > + /* Expect fd 2 is closed. > + But on HP-UX 11, fd 2 gets automatically re-opened to /dev/null if > it > + was closed. */ > +#if !defined __hpux > ASSERT (! is_open (STDERR_FILENO)); > +#endif > break; > default: > ASSERT (0); > > -- > In memoriam Johanna Kirchner <http://en.wikipedia.org/wiki/Johanna_Kirchner> > >