bug-gnulib
[Top][All Lists]
Advanced

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

Re: STDERR_FILENO on HP-UX


From: Bastien ROUCARIES
Subject: Re: STDERR_FILENO on HP-UX
Date: Thu, 9 Jun 2011 11:49:53 +0200

On Thu, Jun 9, 2011 at 11:44 AM, Bruno Haible <address@hidden> 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  <address@hidden>
>
>        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>
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]