]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
doc: mention Bash 2.03 bug with backslash-newline
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 5 Jan 2012 20:32:12 +0000 (12:32 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 5 Jan 2012 20:33:05 +0000 (12:33 -0800)
* doc/autoconf.texi (Invoking the Shell): New section.
(Backslash-Newline-Empty): Rename from Backslash-Newline-Newline.
Mention problem with Bash 2.03.

ChangeLog
doc/autoconf.texi

index 238c09f68ece8f4bab001143e43f4f82eebb853e..69df4058c701ac5cf49273548e0bacc22864fd44 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-01-05  Paul Eggert  <eggert@cs.ucla.edu>
 
+       doc: mention Bash 2.03 bug with backslash-newline
+       * doc/autoconf.texi (Invoking the Shell): New section.
+       (Backslash-Newline-Empty): Rename from Backslash-Newline-Newline.
+       Mention problem with Bash 2.03.
+
        doc: clarify sed buffer limit
        * doc/autoconf.texi (Limitations of Usual Tools):
        That 4000-byte limit applies to output and internal buffers, too.
index ea2419bcf4dcda8abd8eee6b1a1f2ed9daa29531..5c3feef7b33e9a78ecfc3bb71a6d93087c890e6d 100644 (file)
@@ -501,6 +501,7 @@ Dependencies Between Macros
 Portable Shell Programming
 
 * Shellology::                  A zoology of shells
+* Invoking the Shell::          Invoking the shell as a command
 * Here-Documents::              Quirks and tricks
 * File Descriptors::            FDs and redirections
 * Signal Handling::             Shells, signals, and headaches
@@ -520,7 +521,7 @@ Portable Make Programming
 * $< in Ordinary Make Rules::   $< in ordinary rules
 * Failure in Make Rules::       Failing portably in rules
 * Special Chars in Names::      Special Characters in Macro Names
-* Backslash-Newline-Newline::   Empty last lines in macro definitions
+* Backslash-Newline-Empty::     Empty lines after backslash-newline
 * Backslash-Newline Comments::  Spanning comments across line boundaries
 * Long Lines in Makefiles::     Line length limitations
 * Macros and Submakes::         @code{make macro=value} and submakes
@@ -15067,6 +15068,7 @@ subset described above, is fairly portable nowadays.  Also please see
 
 @menu
 * Shellology::                  A zoology of shells
+* Invoking the Shell::          Invoking the shell as a command
 * Here-Documents::              Quirks and tricks
 * File Descriptors::            FDs and redirections
 * Signal Handling::             Shells, signals, and headaches
@@ -15205,6 +15207,28 @@ The default Mac OS X @command{sh} was originally Zsh; it was changed to
 Bash in Mac OS X 10.2.
 @end table
 
+@node Invoking the Shell
+@section Invoking the Shell
+@cindex invoking the shell
+@cindex shell invocation
+
+Bash 2.03 has a bug when invoked with the @option{-c} option: if the
+option-argument ends in backslash-newline, Bash incorrectly reports a
+syntax error.  The problem does not occur if a character follows the
+backslash:
+
+@example
+$ @kbd{$ bash -c 'echo foo \}
+> @kbd{'}
+bash: -c: line 2: syntax error: unexpected end of file
+$ @kbd{bash -c 'echo foo \}
+> @kbd{ '}
+foo
+@end example
+
+@noindent
+@xref{Backslash-Newline-Empty}, for how this can cause problems in makefiles.
+
 @node Here-Documents
 @section Here-Documents
 @cindex Here-documents
@@ -19663,7 +19687,7 @@ itself.
 * $< in Ordinary Make Rules::   $< in ordinary rules
 * Failure in Make Rules::       Failing portably in rules
 * Special Chars in Names::      Special Characters in Macro Names
-* Backslash-Newline-Newline::   Empty last lines in macro definitions
+* Backslash-Newline-Empty::     Empty lines after backslash-newline
 * Backslash-Newline Comments::  Spanning comments across line boundaries
 * Long Lines in Makefiles::     Line length limitations
 * Macros and Submakes::         @code{make macro=value} and submakes
@@ -19741,8 +19765,32 @@ this is test
 @noindent
 However, this problem is no longer of practical concern.
 
-@node Backslash-Newline-Newline
-@section Backslash-Newline-Newline in Make Macro Values
+@node Backslash-Newline-Empty
+@section Backslash-Newline Before Empty Lines
+
+A bug in Bash 2.03 can cause problems if a Make rule contains a
+backslash-newline followed by line that expands to nothing.
+For example, on Solaris 8:
+
+@example
+SHELL = /bin/bash
+EMPTY =
+foo:
+       touch foo \
+       $(EMPTY)
+@end example
+
+@noindent
+executes
+
+@example
+/bin/bash -c 'touch foo \
+'
+@end example
+
+@noindent
+which fails with a syntax error, due to the Bash bug.  To avoid this
+problem, avoid nullable macros in the last line of a multiline command.
 
 @c  This has been seen on ia64 hpux 11.20, and on one hppa hpux 10.20,
 @c  but another hppa hpux 10.20 didn't have it.  Bob Proulx