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