* m4/sh-filename.m4: New file.
* modules/sh-filename: New file.
* lib/spawni.c (_PATH_BSHELL): Use BOURNE_SHELL instead of hardcoding
"/bin/sh".
* tests/test-posix_spawn1.c (main): Likewise.
* tests/test-posix_spawn2.c (main): Likewise.
* lib/javacomp.c (compile_using_envjavac, is_envjavac_gcj,
is_envjavac_gcj43): Likewise.
* lib/javaexec.c (execute_java_class): Likewise.
* modules/posix_spawn-internal (Depends-on): Add sh-filename.
* modules/posix_spawnp-tests (Depends-on): Likewise.
* modules/javacomp (Depends-on): Likewise.
* modules/javaexec (Depends-on): Likewise.
+2018-10-04 Bruno Haible <bruno@clisp.org>
+
+ sh-filename: New module.
+ * m4/sh-filename.m4: New file.
+ * modules/sh-filename: New file.
+ * lib/spawni.c (_PATH_BSHELL): Use BOURNE_SHELL instead of hardcoding
+ "/bin/sh".
+ * tests/test-posix_spawn1.c (main): Likewise.
+ * tests/test-posix_spawn2.c (main): Likewise.
+ * lib/javacomp.c (compile_using_envjavac, is_envjavac_gcj,
+ is_envjavac_gcj43): Likewise.
+ * lib/javaexec.c (execute_java_class): Likewise.
+ * modules/posix_spawn-internal (Depends-on): Add sh-filename.
+ * modules/posix_spawnp-tests (Depends-on): Likewise.
+ * modules/javacomp (Depends-on): Likewise.
+ * modules/javaexec (Depends-on): Likewise.
+
2018-10-04 Bruno Haible <bruno@clisp.org>
spawn-pipe tests: Avoid test failure on native Windows.
if (verbose)
printf ("%s\n", command);
- argv[0] = "/bin/sh";
+ argv[0] = BOURNE_SHELL;
argv[1] = "-c";
argv[2] = command;
argv[3] = NULL;
- exitstatus = execute (javac, "/bin/sh", argv, false, false, false,
+ exitstatus = execute (javac, BOURNE_SHELL, argv, false, false, false,
null_stderr, true, true, NULL);
err = (exitstatus != 0);
abort ();
/* Call $JAVAC --version 2>/dev/null. */
- argv[0] = "/bin/sh";
+ argv[0] = BOURNE_SHELL;
argv[1] = "-c";
argv[2] = command;
argv[3] = NULL;
- child = create_pipe_in (javac, "/bin/sh", argv, DEV_NULL, true, true,
+ child = create_pipe_in (javac, BOURNE_SHELL, argv, DEV_NULL, true, true,
false, fd);
if (child == -1)
goto failed;
abort ();
/* Call $JAVAC --version 2>/dev/null. */
- argv[0] = "/bin/sh";
+ argv[0] = BOURNE_SHELL;
argv[1] = "-c";
argv[2] = command;
argv[3] = NULL;
- child = create_pipe_in (javac, "/bin/sh", argv, DEV_NULL, true, true,
+ child = create_pipe_in (javac, BOURNE_SHELL, argv, DEV_NULL, true, true,
false, fd);
if (child == -1)
goto failed;
if (verbose)
printf ("%s\n", command);
- argv[0] = "/bin/sh";
+ argv[0] = BOURNE_SHELL;
argv[1] = "-c";
argv[2] = command;
argv[3] = NULL;
- err = executer (java, "/bin/sh", argv, private_data);
+ err = executer (java, BOURNE_SHELL, argv, private_data);
freea (command);
#if _LIBC || HAVE_PATHS_H
# include <paths.h>
#else
-# define _PATH_BSHELL "/bin/sh"
+# define _PATH_BSHELL BOURNE_SHELL
#endif
#include <signal.h>
--- /dev/null
+# sh-filename.m4 serial 1
+dnl Copyright (C) 2018 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([gl_SH_FILENAME],
+[
+ AH_VERBATIM([SH_FILENAME],
+[/* File name of the Bourne shell. */
+#if defined __CYGWIN__
+/* Omit the directory part because for 32-bit Cygwin programs in a
+ 64-bit Cygwin environment, the Cygwin mounts are not visible. */
+# define BOURNE_SHELL "sh"
+#else
+# define BOURNE_SHELL "/bin/sh"
+#endif])
+])
c-strstr
gettext-h
javacomp-script
+sh-filename
configure.ac:
error
gettext-h
javaexec-script
+sh-filename
configure.ac:
dup2
errno
open
+sh-filename
strchrnul
configure.ac:
sys_wait
dup
environ
+sh-filename
sigprocmask
configure.ac:
--- /dev/null
+Description:
+Provide BOURNE_SHELL, the file name of the standard Bourne shell.
+
+Files:
+m4/sh-filename.m4
+
+Depends-on:
+
+configure.ac:
+gl_SH_FILENAME
+
+Makefile.am:
+
+Include:
+
+License:
+LGPLv2+
+
+Maintainer:
+all
int
main ()
{
- char *argv[3] = { (char *) "/bin/sh", (char *) CHILD_PROGRAM_FILENAME, NULL };
+ char *argv[3] = { (char *) BOURNE_SHELL, (char *) CHILD_PROGRAM_FILENAME, NULL };
int ifd[2];
sigset_t blocked_signals;
sigset_t fatal_signal_set;
|| (attrs_allocated = true,
(err = posix_spawnattr_setsigmask (&attrs, &blocked_signals)) != 0
|| (err = posix_spawnattr_setflags (&attrs, POSIX_SPAWN_SETSIGMASK)) != 0)
- || (err = posix_spawnp (&child, "/bin/sh", &actions, &attrs, argv, environ)) != 0))
+ || (err = posix_spawnp (&child, BOURNE_SHELL, &actions, &attrs, argv, environ)) != 0))
{
if (actions_allocated)
posix_spawn_file_actions_destroy (&actions);
int
main ()
{
- char *argv[3] = { (char *) "/bin/sh", (char *) CHILD_PROGRAM_FILENAME, NULL };
+ char *argv[3] = { (char *) BOURNE_SHELL, (char *) CHILD_PROGRAM_FILENAME, NULL };
int ofd[2];
sigset_t blocked_signals;
sigset_t fatal_signal_set;
|| (attrs_allocated = true,
(err = posix_spawnattr_setsigmask (&attrs, &blocked_signals)) != 0
|| (err = posix_spawnattr_setflags (&attrs, POSIX_SPAWN_SETSIGMASK)) != 0)
- || (err = posix_spawnp (&child, "/bin/sh", &actions, &attrs, argv, environ)) != 0))
+ || (err = posix_spawnp (&child, BOURNE_SHELL, &actions, &attrs, argv, environ)) != 0))
{
if (actions_allocated)
posix_spawn_file_actions_destroy (&actions);