changeset 30137:f8a896837471

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.
author Jim Meyering <meyering@redhat.com>
date Sun, 14 Sep 2008 00:05:26 +0200
parents 344142aabdce
children 09fc0fc9c1d7
files ChangeLog m4/posix-shell.m4
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Sep 16 10:26:26 2008 +0200
+++ b/ChangeLog	Sun Sep 14 00:05:26 2008 +0200
@@ -1,3 +1,11 @@
+2008-09-16  Jim Meyering  <meyering@redhat.com>
+
+	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  <bonzini@gnu.org>
 
 	* tests/test-poll.c (connect_to_socket): Allow non-blocking connect
--- a/m4/posix-shell.m4	Tue Sep 16 10:26:26 2008 +0200
+++ b/m4/posix-shell.m4	Sun Sep 14 00:05:26 2008 +0200
@@ -31,12 +31,16 @@
        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