From 4f26ef2e4e431adbe04f2929f775240d7f3fb466 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 14 Sep 2008 00:05:26 +0200 Subject: [PATCH] posix-shell.m4: reject opensolaris's "sh (AT&T Research) 1993-12-28 s+" * m4/posix-shell.m4 (gl_POSIX_SHELL): Reject a shell that lets a umask modification leak out of a subshell. Otherwise, the opensolaris /bin/sh would be accepted and thus cause unwarranted failures in the coreutils test suite. --- ChangeLog | 8 ++++++++ m4/posix-shell.m4 | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 32e7ed9f8..0ea00e63c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-09-16 Jim Meyering + + posix-shell.m4: reject opensolaris's "sh (AT&T Research) 1993-12-28 s+" + * m4/posix-shell.m4 (gl_POSIX_SHELL): Reject a shell that lets + a umask modification leak out of a subshell. Otherwise, the + opensolaris /bin/sh would be accepted and thus cause unwarranted + failures in the coreutils test suite. + 2008-09-16 Paolo Bonzini * tests/test-poll.c (connect_to_socket): Allow non-blocking connect diff --git a/m4/posix-shell.m4 b/m4/posix-shell.m4 index 7f3b1e944..4c56193c1 100644 --- a/m4/posix-shell.m4 +++ b/m4/posix-shell.m4 @@ -31,12 +31,16 @@ AC_DEFUN([gl_POSIX_SHELL], func_ret_failure () { return 1 } + subshell_umask_sanity () { + (umask 22; (umask 0); test $(umask) -eq 22) + } test "[$](echo foo)" = foo && func_success && ! func_failure && func_ret_success && ! func_ret_failure && - (set x && func_ret_success y && test x = "[$]1") + (set x && func_ret_success y && test x = "[$]1") && + subshell_umask_sanity ' for gl_cv_posix_shell in \ "$CONFIG_SHELL" "$SHELL" /bin/sh /bin/bash /bin/ksh /bin/sh5 no; do -- 2.11.0