bug-gnulib
[Top][All Lists]
Advanced

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

Re: Fwd: gnulib posix_spawn_file_actions_addclose


From: Bruno Haible
Subject: Re: Fwd: gnulib posix_spawn_file_actions_addclose
Date: Wed, 07 Sep 2022 23:44:55 +0200

Valery Ushakov wrote:
> However for the addclose case the [1] says in the ERRORS section:
> 
>   The posix_spawn_file_actions_addopen() function shall fail if:
> 
>   [EBADF]
>       The value specified by fildes is negative or greater than or
>       equal to {OPEN_MAX}.
> 
>   The posix_spawn_file_actions_addclose() function shall fail if:
> 
>   [EBADF]
>       The value specified by fildes is negative. 

Ah, I see: I initially wrote the test based on the old specification [0].
Then POSIX changed the part about posix_spawn_file_actions_addclose [1].
Then, in 2021 I acknowledged this through commit [2].

At the time, musl libc still had the bug regarding the negative file
descriptors; therefore the configure test said "no", gnulib added its
replacement, and the unit test succeeded.

Now, you have discovered that musl libc no longer has the bug regarding
the negative file descriptors; therefore the configure test says "yes",
gnulib no longer overrides the function, and the unit test now fails.

The patch below should fix it.

[0] 
https://pubs.opengroup.org/onlinepubs/009695399/functions/posix_spawn_file_actions_addclose.html
[1] 
https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn_file_actions_addclose.html
[2] 
https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=36a838b081de0d2c62970df5b4b8d736d3aebe1d


2022-09-07  Bruno Haible  <bruno@clisp.org>

        posix_spawn_file_actions_addclose tests: Avoid test failure on musl.
        Reported by Valery Ushakov <uwe@stderr.spb.ru> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2022-09/msg00041.html>.
        * modules/posix_spawn_file_actions_addclose-tests (configure.ac): Invoke
        gl_MUSL_LIBC.
        * tests/test-posix_spawn_file_actions_addclose.c (main): Skip one of the
        tests on musl libc.

diff --git a/modules/posix_spawn_file_actions_addclose-tests 
b/modules/posix_spawn_file_actions_addclose-tests
index b115e3dfca..701e04dc17 100644
--- a/modules/posix_spawn_file_actions_addclose-tests
+++ b/modules/posix_spawn_file_actions_addclose-tests
@@ -9,6 +9,7 @@ posix_spawn_file_actions_init
 posix_spawn_file_actions_destroy
 
 configure.ac:
+gl_MUSL_LIBC
 
 Makefile.am:
 TESTS += test-posix_spawn_file_actions_addclose
diff --git a/tests/test-posix_spawn_file_actions_addclose.c 
b/tests/test-posix_spawn_file_actions_addclose.c
index c5238c3e38..d0ab33d14f 100644
--- a/tests/test-posix_spawn_file_actions_addclose.c
+++ b/tests/test-posix_spawn_file_actions_addclose.c
@@ -55,12 +55,14 @@ main (void)
     ASSERT (posix_spawn_file_actions_addclose (&actions, -1) == EBADF);
   }
   /* This behaviour is not mandated by POSIX, but happens to pass on all
-     platforms.  */
+     platforms except musl libc.  */
+#if !defined MUSL_LIBC
   {
     int bad_fd = big_fd ();
     errno = 0;
     ASSERT (posix_spawn_file_actions_addclose (&actions, bad_fd) == EBADF);
   }
+#endif
 
   posix_spawn_file_actions_destroy (&actions);
 






reply via email to

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