#! /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-037 BASH PATCH REPORT ================= Bash-Release: 3.2 Patch-ID: bash32-037 Bug-Reported-by: jared r r spiegel Bug-Reference-ID: <200801152201.m0FM1lDp021260@iorek.ice-nine.org> Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2008-01/msg00049.html Bug-Description: Bash inappropriately evaluates command substitutions while expanding directory names as part of command substitution. Patch: *** ../bash-3.2-patched/subst.c 2007-12-13 22:31:21.000000000 -0500 --- subst.c 2008-01-17 22:48:15.000000000 -0500 *************** *** 2815,2821 **** to jump_to_top_level here so we don't endlessly loop. */ WORD_LIST * ! expand_prompt_string (string, quoted) char *string; int quoted; { WORD_LIST *value; --- 2895,2902 ---- to jump_to_top_level here so we don't endlessly loop. */ WORD_LIST * ! expand_prompt_string (string, quoted, wflags) char *string; int quoted; + int wflags; { WORD_LIST *value; *************** *** 2825,2829 **** return ((WORD_LIST *)NULL); ! td.flags = 0; td.word = savestring (string); --- 2906,2910 ---- return ((WORD_LIST *)NULL); ! td.flags = wflags; td.word = savestring (string); *** ../bash-3.2-patched/subst.h 2007-03-24 14:51:05.000000000 -0400 --- subst.h 2008-01-17 22:46:08.000000000 -0500 *************** *** 136,140 **** /* Expand a prompt string. */ ! extern WORD_LIST *expand_prompt_string __P((char *, int)); /* Expand STRING just as if you were expanding a word. This also returns --- 137,141 ---- /* Expand a prompt string. */ ! extern WORD_LIST *expand_prompt_string __P((char *, int, int)); /* Expand STRING just as if you were expanding a word. This also returns *** ../bash-3.2-patched/parse.y 2007-08-25 13:47:06.000000000 -0400 --- parse.y 2008-01-17 22:46:30.000000000 -0500 *************** *** 4367,4371 **** { last_exit_value = last_command_exit_value; ! list = expand_prompt_string (result, Q_DOUBLE_QUOTES); free (result); result = string_list (list); --- 4367,4371 ---- { last_exit_value = last_command_exit_value; ! list = expand_prompt_string (result, Q_DOUBLE_QUOTES, 0); free (result); result = string_list (list); *** ../bash-3.2-patched/bashline.c 2006-07-29 16:39:30.000000000 -0400 --- bashline.c 2008-02-17 12:53:42.000000000 -0500 *************** *** 2358,2362 **** { new_dirname = savestring (local_dirname); ! wl = expand_prompt_string (new_dirname, 0); /* does the right thing */ if (wl) { --- 2376,2380 ---- { new_dirname = savestring (local_dirname); ! wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB); /* does the right thing */ if (wl) { *** ../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 36 #endif /* _PATCHLEVEL_H_ */ --- 26,30 ---- looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 37 #endif /* _PATCHLEVEL_H_ */