summaryrefslogtreecommitdiff
path: root/debian/patches/bash32-039.dpatch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/bash32-039.dpatch')
-rw-r--r--debian/patches/bash32-039.dpatch180
1 files changed, 180 insertions, 0 deletions
diff --git a/debian/patches/bash32-039.dpatch b/debian/patches/bash32-039.dpatch
new file mode 100644
index 0000000..f39fde8
--- /dev/null
+++ b/debian/patches/bash32-039.dpatch
@@ -0,0 +1,180 @@
+#! /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: bash-3.2 upstream patch bash32-039
+
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 3.2
+Patch-ID: bash32-039
+
+Bug-Reported-by: rew@erebor.com
+Bug-Reference-ID: <20070119065603.546D011E9C@kansas.erebor.com>
+Bug-Reference-URL:
+
+Bug-Description:
+
+Bash-3.2 changed the behavior of the [[ command's `=~' operator when the
+right-hand side was quoted: it matched the quoted portions as strings.
+This patch introduces a new shell option: compat31. When enabled, it
+restores the bash-3.1 behavior with respect to evaluating quoted arguments
+to the =~ operator.
+
+Patch:
+
+*** ../bash-3.2-patched/execute_cmd.c 2007-12-14 21:12:39.000000000 -0500
+--- execute_cmd.c 2008-02-22 21:20:40.000000000 -0500
+***************
+*** 2547,2551 ****
+ if (arg1 == 0)
+ arg1 = nullstr;
+! arg2 = cond_expand_word (cond->right->op, rmatch ? 2 : (patmatch ? 1 : 0));
+ if (arg2 == 0)
+ arg2 = nullstr;
+--- 2552,2557 ----
+ if (arg1 == 0)
+ arg1 = nullstr;
+! arg2 = cond_expand_word (cond->right->op,
+! (rmatch && shell_compatibility_level > 31) ? 2 : (patmatch ? 1 : 0));
+ if (arg2 == 0)
+ arg2 = nullstr;
+*** ../bash-3.2-patched/shell.h 2003-06-01 15:04:36.000000000 -0400
+--- shell.h 2008-02-22 21:16:48.000000000 -0500
+***************
+*** 90,93 ****
+--- 90,94 ----
+ extern int interactive, interactive_shell;
+ extern int startup_state;
++ extern int shell_compatibility_level;
+
+ /* Structure to pass around that holds a bitmap of file descriptors
+*** ../bash-3.2-patched/version.c 2007-12-14 21:12:29.000000000 -0500
+--- version.c 2008-04-10 08:22:22.000000000 -0400
+***************
+*** 44,47 ****
+--- 44,50 ----
+ const char *sccs_version = SCCSVERSION;
+
++ /* If == 31, shell compatible with bash-3.1, == 32 with bash-3.2, and so on */
++ int shell_compatibility_level = 32;
++
+ /* Functions for getting, setting, and displaying the shell version. */
+
+*** ../bash-3.2-patched/builtins/shopt.def 2005-02-19 17:25:03.000000000 -0500
+--- builtins/shopt.def 2008-04-10 08:13:32.000000000 -0400
+***************
+*** 102,105 ****
+--- 102,107 ----
+ static int set_shellopts_after_change __P((int));
+
++ static int set_compatibility_level __P((int));
++
+ #if defined (RESTRICTED_SHELL)
+ static int set_restricted_shell __P((int));
+***************
+*** 107,110 ****
+--- 109,113 ----
+
+ static int shopt_login_shell;
++ static int shopt_compat31;
+
+ typedef int shopt_set_func_t __P((int));
+***************
+*** 122,125 ****
+--- 125,129 ----
+ { "cmdhist", &command_oriented_history, (shopt_set_func_t *)NULL },
+ #endif
++ { "compat31", &shopt_compat31, set_compatibility_level },
+ { "dotglob", &glob_dot_filenames, (shopt_set_func_t *)NULL },
+ { "execfail", &no_exit_on_failed_exec, (shopt_set_func_t *)NULL },
+***************
+*** 460,463 ****
+--- 464,479 ----
+ }
+
++ static int
++ set_compatibility_level (mode)
++ int mode;
++ {
++ /* Need to change logic here as we add more compatibility levels */
++ if (shopt_compat31)
++ shell_compatibility_level = 31;
++ else
++ shell_compatibility_level = 32;
++ return 0;
++ }
++
+ #if defined (RESTRICTED_SHELL)
+ /* Don't allow the value of restricted_shell to be modified. */
+*** ../bash-3.2-patched/doc/bash.1 2006-09-28 10:26:05.000000000 -0400
+--- doc/bash.1 2008-04-25 12:32:49.000000000 -0400
+***************
+*** 7978,7981 ****
+--- 8200,8209 ----
+ easy re-editing of multi-line commands.
+ .TP 8
++ .B compat31
++ If set,
++ .B bash
++ changes its behavior to that of version 3.1 with respect to quoted
++ arguments to the conditional command's =~ operator.
++ .TP 8
+ .B dotglob
+ If set,
+*** ../bash-3.2-patched/tests/shopt.right 2005-02-19 17:46:09.000000000 -0500
+--- tests/shopt.right 2008-04-28 09:13:07.000000000 -0400
+***************
+*** 7,10 ****
+--- 7,11 ----
+ shopt -u checkwinsize
+ shopt -s cmdhist
++ shopt -u compat31
+ shopt -u dotglob
+ shopt -u execfail
+***************
+*** 54,57 ****
+--- 55,59 ----
+ shopt -u checkhash
+ shopt -u checkwinsize
++ shopt -u compat31
+ shopt -u dotglob
+ shopt -u execfail
+***************
+*** 78,81 ****
+--- 80,84 ----
+ checkhash off
+ checkwinsize off
++ compat31 off
+ dotglob off
+ execfail off
+
+*** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006
+--- patchlevel.h Mon Oct 16 14:22:54 2006
+***************
+*** 26,30 ****
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 38
+
+ #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 39
+
+ #endif /* _PATCHLEVEL_H_ */