1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 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_ */
|