]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
doc: Mention two more shell portability problems.
authorBruno Haible <bruno@clisp.org>
Thu, 17 Sep 2020 23:17:38 +0000 (01:17 +0200)
committerZack Weinberg <zackw@panix.com>
Fri, 18 Sep 2020 13:22:10 +0000 (09:22 -0400)
* doc/autoconf.texi (File Descriptors): Mention a problem of Solaris 10.
Mention that a known problem also occurs in dash.

doc/autoconf.texi

index 4bd6e9e7d5ba7729a9b1dc163c453a54fc26d5e5..38646a16fff1de51c4622bfb3df95470b675c9f0 100644 (file)
@@ -15656,6 +15656,18 @@ $ @kbd{dash -c ': 1<>file'; cat file}
 $ rm a
 @end example
 
+Solaris 10 @code{/bin/sh} executes redirected compound commands
+in a subshell, while other shells don't:
+
+@example
+$ @kbd{/bin/sh -c 'foo=0; @{ foo=1; @} 2>/dev/null; echo $foo'}
+0
+$ @kbd{ksh -c 'foo=0; @{ foo=1; @} 2>/dev/null; echo $foo'}
+1
+$ @kbd{bash -c 'foo=0; @{ foo=1; @} 2>/dev/null; echo $foo'}
+1
+@end example
+
 When catering to old systems, don't redirect the same file descriptor
 several times, as you are doomed to failure under Ultrix.
 
@@ -15756,8 +15768,8 @@ obsolete, so it's now safe to treat file descriptors 3 and 4 like any
 other file descriptors.
 
 On the other hand, you can't portably use multi-digit file descriptors.
-Solaris @command{ksh} doesn't understand any file descriptor larger than
-@samp{9}:
+@command{dash} and Solaris @command{ksh} don't understand any file
+descriptor larger than @samp{9}:
 
 @example
 $ @kbd{bash -c 'exec 10>&-'; echo $?}
@@ -15767,6 +15779,11 @@ $ @kbd{ksh -c 'exec 9>&-'; echo $?}
 $ @kbd{ksh -c 'exec 10>&-'; echo $?}
 ksh[1]: exec: 10: not found
 127
+$ @kbd{dash -c 'exec 9>&-'; echo $?}
+0
+$ @kbd{dash -c 'exec 10>&-'; echo $?}
+exec: 1: 10: not found
+2
 @end example
 
 @c <https://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>