summaryrefslogtreecommitdiff
path: root/debian/patches/bash31-010.dpatch
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2007-11-12 13:13:20 -0800
committerAn-Cheng Huang <ancheng@vyatta.com>2007-11-14 16:16:47 -0800
commitfc7695ee76400ee9833301f98a3fe483d64591b5 (patch)
tree15b568f5adfa956817cf9f5a1652c43d33d8efa9 /debian/patches/bash31-010.dpatch
parentb7fc9e0f6d6105ba2203f219743d4b269415e84b (diff)
downloadvyatta-bash-fc7695ee76400ee9833301f98a3fe483d64591b5.tar.gz
vyatta-bash-fc7695ee76400ee9833301f98a3fe483d64591b5.zip
initial import from bash_3.1dfsg-8.diff.gzupstream
Diffstat (limited to 'debian/patches/bash31-010.dpatch')
-rwxr-xr-xdebian/patches/bash31-010.dpatch183
1 files changed, 183 insertions, 0 deletions
diff --git a/debian/patches/bash31-010.dpatch b/debian/patches/bash31-010.dpatch
new file mode 100755
index 0000000..ad00d2b
--- /dev/null
+++ b/debian/patches/bash31-010.dpatch
@@ -0,0 +1,183 @@
+#! /bin/sh -e
+
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+ pdir="-d $3"
+elif [ $# -ne 1 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+case "$1" in
+ -patch) patch $pdir -f --no-backup-if-mismatch -p0 < $0;;
+ -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p0 < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+esac
+exit 0
+
+# DP: Upstream patch bash31-010
+
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 3.1
+Patch-ID: bash31-010
+
+Bug-Reported-by: vw@vonwolff.de
+Bug-Reference-ID: <20060123135234.1AC2F1D596@wst07.vonwolff.de>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2006-01/msg00090.html
+
+Bug-Description:
+
+There is a difference in behavior between bash-3.0 and bash-3.1 involving
+parsing of single- and double-quoted strings occurring in old-style
+command substitution. The difference has to do with how backslashes are
+processed. This patch restores a measure of backwards compatibility while
+the question of POSIX conformance and ultimately correct behavior is discussed.
+
+THIS IS AN UPDATED PATCH. USE THIS COMMAND TO REVERSE THE EFFECTS OF
+THE ORIGINAL PATCH. THE CURRENT DIRECTORY MUST BE THE BASH-3.1 SOURCE
+DIRECTORY.
+
+patch -p0 -R < bash31-010.orig
+
+Then apply this patch as usual.
+
+Patch:
+
+*** ../bash-3.1/parse.y Fri Nov 11 23:14:18 2005
+--- parse.y Thu Feb 23 08:21:12 2006
+***************
+*** 2716,2721 ****
+--- 2723,2729 ----
+ #define P_ALLOWESC 0x02
+ #define P_DQUOTE 0x04
+ #define P_COMMAND 0x08 /* parsing a command, so look for comments */
++ #define P_BACKQUOTE 0x10 /* parsing a backquoted command substitution */
+
+ static char matched_pair_error;
+ static char *
+***************
+*** 2725,2736 ****
+ int *lenp, flags;
+ {
+ int count, ch, was_dollar, in_comment, check_comment;
+! int pass_next_character, nestlen, ttranslen, start_lineno;
+ char *ret, *nestret, *ttrans;
+ int retind, retsize, rflags;
+
+ count = 1;
+! pass_next_character = was_dollar = in_comment = 0;
+ check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
+
+ /* RFLAGS is the set of flags we want to pass to recursive calls. */
+--- 2733,2744 ----
+ int *lenp, flags;
+ {
+ int count, ch, was_dollar, in_comment, check_comment;
+! int pass_next_character, backq_backslash, nestlen, ttranslen, start_lineno;
+ char *ret, *nestret, *ttrans;
+ int retind, retsize, rflags;
+
+ count = 1;
+! pass_next_character = backq_backslash = was_dollar = in_comment = 0;
+ check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
+
+ /* RFLAGS is the set of flags we want to pass to recursive calls. */
+***************
+*** 2742,2752 ****
+ start_lineno = line_number;
+ while (count)
+ {
+! #if 0
+! ch = shell_getc ((qc != '\'' || (flags & P_ALLOWESC)) && pass_next_character == 0);
+! #else
+! ch = shell_getc (qc != '\'' && pass_next_character == 0);
+! #endif
+ if (ch == EOF)
+ {
+ free (ret);
+--- 2750,2757 ----
+ start_lineno = line_number;
+ while (count)
+ {
+! ch = shell_getc (qc != '\'' && pass_next_character == 0 && backq_backslash == 0);
+!
+ if (ch == EOF)
+ {
+ free (ret);
+***************
+*** 2771,2779 ****
+ continue;
+ }
+ /* Not exactly right yet */
+! else if (check_comment && in_comment == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || whitespace (ret[retind -1])))
+ in_comment = 1;
+
+ if (pass_next_character) /* last char was backslash */
+ {
+ pass_next_character = 0;
+--- 2776,2791 ----
+ continue;
+ }
+ /* Not exactly right yet */
+! else if MBTEST(check_comment && in_comment == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || whitespace (ret[retind - 1])))
+ in_comment = 1;
+
++ /* last char was backslash inside backquoted command substitution */
++ if (backq_backslash)
++ {
++ backq_backslash = 0;
++ /* Placeholder for adding special characters */
++ }
++
+ if (pass_next_character) /* last char was backslash */
+ {
+ pass_next_character = 0;
+***************
+*** 2814,2819 ****
+--- 2824,2831 ----
+ {
+ if MBTEST((flags & P_ALLOWESC) && ch == '\\')
+ pass_next_character++;
++ else if MBTEST((flags & P_BACKQUOTE) && ch == '\\')
++ backq_backslash++;
+ continue;
+ }
+
+***************
+*** 2898,2904 ****
+ }
+ else if MBTEST(qc == '`' && (ch == '"' || ch == '\'') && in_comment == 0)
+ {
+! nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags);
+ goto add_nestret;
+ }
+ else if MBTEST(was_dollar && (ch == '(' || ch == '{' || ch == '[')) /* ) } ] */
+--- 2910,2920 ----
+ }
+ else if MBTEST(qc == '`' && (ch == '"' || ch == '\'') && in_comment == 0)
+ {
+! /* Add P_BACKQUOTE so backslash quotes the next character and
+! shell_getc does the right thing with \<newline>. We do this for
+! a measure of backwards compatibility -- it's not strictly the
+! right POSIX thing. */
+! nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags|P_BACKQUOTE);
+ goto add_nestret;
+ }
+ else if MBTEST(was_dollar && (ch == '(' || ch == '{' || ch == '[')) /* ) } ] */
+*** ../bash-3.1/patchlevel.h Wed Jul 20 13:58:20 2005
+--- patchlevel.h Wed Dec 7 13:48:42 2005
+***************
+*** 26,30 ****
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 9
+
+ #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 10
+
+ #endif /* _PATCHLEVEL_H_ */