[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: what does regex depend on sys_wait?
From: |
Bruno Haible |
Subject: |
Re: what does regex depend on sys_wait? |
Date: |
Tue, 28 Sep 2010 21:33:38 +0200 |
User-agent: |
KMail/1.9.9 |
Eric Blake wrote:
> Hmm - this would be the first time that one of our replacement headers
> #includes a non-replacement header
I agree that we shouldn't go this route. libunistring installs the gnulib-
created variants of stdint.h and stdbool.h in public locations (under different
names); I think some of Simon's packages do the same.
Thinking more _why_ should <stdlib.h> declare WIFEXITED etc. at all? Most
programs I've seen include <sys/wait.h> for this purpose. The answer is that
<stdlib.h> declares the system() function and WIFEXITED etc. are useful for
analyzing its return code.
So my proposal would be
- Introduce a new module 'system', that provides all a user needs for using
the system() function according to POSIX.
- Make dependencies system -> stdlib
system -> sys_wait
but not stdlib -> sys_wait.
- Change <stdlib.h> so that it #include <sys/wait.h> only when the 'system'
module has been requested.
Opinions?
Bruno
2010-09-28 Bruno Haible <address@hidden>
New module 'system'.
* modules/system: New file.
* lib/stdlib.in.h: Include <sys/wait.h> only when the 'system' module
is present.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize GNULIB_SYSTEM.
* modules/stdlib (Depends-on): Remove sys_wait.
(Makefile.am): Substitute GNULIB_SYSTEM.
* doc/posix-functions/system.texi: Mention the new module.
* doc/posix-headers/stdlib.texi: Likewise.
Reported by Sam Steingold <address@hidden>.
=============================== modules/system ===============================
Description:
system() function: execute a shell command
Files:
Depends-on:
stdlib
sys_wait
configure.ac:
gl_STDLIB_MODULE_INDICATOR([system])
Makefile.am:
Include:
<stdlib.h>
License:
LGPL
Maintainer:
Bruno Haible
==============================================================================
--- doc/posix-functions/system.texi.orig Tue Sep 28 21:29:09 2010
+++ doc/posix-functions/system.texi Tue Sep 28 21:22:16 2010
@@ -4,10 +4,16 @@
POSIX specification:@*
@url{http://www.opengroup.org/onlinepubs/9699919799/functions/system.html}
-Gnulib module: ---
+Gnulib module: system
Portability problems fixed by Gnulib:
@itemize
address@hidden
+The macros @code{WIFSIGNALED}, @code{WIFEXITED}, @code{WIFSTOPPED},
address@hidden, @code{WEXITSTATUS}, @code{WNOHANG}, @code{WUNTRACED},
address@hidden are not defined in @code{<stdlib.h>} (only in
address@hidden<sys/wait.h>}) on some platforms:
+MirBSD 10.
@end itemize
Portability problems not fixed by Gnulib:
--- doc/posix-headers/stdlib.texi.orig Tue Sep 28 21:29:09 2010
+++ doc/posix-headers/stdlib.texi Tue Sep 28 21:23:15 2010
@@ -3,9 +3,9 @@
POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/stdlib.h.html}
-Gnulib module: stdlib
+Gnulib module: stdlib, system
-Portability problems fixed by Gnulib:
+Portability problems fixed by the Gnulib module @code{stdlib}:
@itemize
@item
The macros @code{EXIT_SUCCESS} and @code{EXIT_FAILURE} are not defined on
@@ -17,7 +17,10 @@
Some platforms provide a @code{NULL} macro that cannot be used in arbitrary
expressions:
NetBSD 5.0
address@hidden itemize
+Portability problems fixed by the Gnulib module @code{system}:
address@hidden
@item
The macros @code{WIFSIGNALED}, @code{WIFEXITED}, @code{WIFSTOPPED},
@code{WTERMSIG}, @code{WEXITSTATUS}, @code{WNOHANG}, @code{WUNTRACED},
--- lib/stdlib.in.h.orig Tue Sep 28 21:29:09 2010
+++ lib/stdlib.in.h Tue Sep 28 21:24:54 2010
@@ -39,7 +39,7 @@
#include <stddef.h>
/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
-#ifndef WEXITSTATUS
+#if @GNULIB_SYSTEM@ && !defined WEXITSTATUS
# include <sys/wait.h>
#endif
--- m4/stdlib_h.m4.orig Tue Sep 28 21:29:09 2010
+++ m4/stdlib_h.m4 Tue Sep 28 21:25:39 2010
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 30
+# stdlib_h.m4 serial 31
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -73,6 +73,7 @@
GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD])
GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL])
GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL])
+ GNULIB_SYSTEM=0; AC_SUBST([GNULIB_SYSTEM])
GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT])
GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV])
dnl Assume proper GNU behavior unless another module says otherwise.
--- modules/stdlib.orig Tue Sep 28 21:29:09 2010
+++ modules/stdlib Tue Sep 28 21:25:16 2010
@@ -11,7 +11,6 @@
include_next
stddef
stdint
-sys_wait
unistd
warn-on-use
@@ -52,6 +51,7 @@
-e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
-e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \
-e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \
+ -e 's|@''GNULIB_SYSTEM''@|$(GNULIB_SYSTEM)|g' \
-e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \
-e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
-e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
- what does regex depend on sys_wait?, Sam Steingold, 2010/09/27
- Re: what does regex depend on sys_wait?, Eric Blake, 2010/09/27
- Re: what does regex depend on sys_wait?, Paul Eggert, 2010/09/27
- Re: what does regex depend on sys_wait?, Bruno Haible, 2010/09/27
- Re: what does regex depend on sys_wait?, Jim Meyering, 2010/09/28
- Re: what does regex depend on sys_wait?, Paul Eggert, 2010/09/28
- Re: what does regex depend on sys_wait?, Eric Blake, 2010/09/28
- Re: what does regex depend on sys_wait?, Eric Blake, 2010/09/28
- Re: what does regex depend on sys_wait?, Paul Eggert, 2010/09/28
- Re: what does regex depend on sys_wait?, Eric Blake, 2010/09/28
- Re: what does regex depend on sys_wait?,
Bruno Haible <=
- Re: what does regex depend on sys_wait?, Paul Eggert, 2010/09/28
- Re: what does regex depend on sys_wait?, Eric Blake, 2010/09/28
- Re: what does regex depend on sys_wait?, Paul Eggert, 2010/09/28
- Re: what does regex depend on sys_wait?, Bruno Haible, 2010/09/28
- Re: what does regex depend on sys_wait?, Eric Blake, 2010/09/28
- Re: what does regex depend on sys_wait?, Bruno Haible, 2010/09/28