bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bash-4.0 Official Patch 24


From: Chet Ramey
Subject: Bash-4.0 Official Patch 24
Date: Thu, 18 Jun 2009 20:56:05 -0400

                             BASH PATCH REPORT
                             =================

Bash-Release: 4.0
Patch-ID: bash40-024

Bug-Reported-by:  Matt Zyzik <address@hidden>
Bug-Reference-ID:  <address@hidden>
Bug-Reference-URL: 
http://lists.gnu.org/archive/html/bug-bash/2009-04/msg00021.html

Bug-Description:

When using the ** globbing operator, bash will incorrectly add an extra
directory name when the preceding directory name ends with `*' or an empty
string when there is no preceding directory name.

Patch:

*** ../bash-4.0-patched/lib/glob/glob.c 2009-01-04 14:32:30.000000000 -0500
--- lib/glob/glob.c     2009-04-28 10:22:29.000000000 -0400
***************
*** 357,361 ****
        if (ep)
          *ep = 0;
!       if (r)
        free (r);
        return (struct globval *)0;
--- 357,361 ----
        if (ep)
          *ep = 0;
!       if (r && r != &glob_error_return)
        free (r);
        return (struct globval *)0;
***************
*** 666,671 ****
      }
  
!   /* compat: if GX_ALLDIRS, add the passed directory also */
!   if (add_current)
      {
        sdlen = strlen (dir);
--- 666,672 ----
      }
  
!   /* compat: if GX_ALLDIRS, add the passed directory also, but don't add an
!      empty directory name. */
!   if (add_current && (flags & GX_NULLDIR) == 0)
      {
        sdlen = strlen (dir);
***************
*** 679,686 ****
          nextlink->next = lastlink;
          lastlink = nextlink;
!         if (flags & GX_NULLDIR)
!           nextname[0] = '\0';
!         else
!           bcopy (dir, nextname, sdlen + 1);
          ++count;
        }
--- 680,684 ----
          nextlink->next = lastlink;
          lastlink = nextlink;
!         bcopy (dir, nextname, sdlen + 1);
          ++count;
        }
***************
*** 943,947 ****
              register unsigned int l;
  
!             array = glob_dir_to_array (directories[i], temp_results, flags);
              l = 0;
              while (array[l] != NULL)
--- 941,950 ----
              register unsigned int l;
  
!             /* If we're expanding **, we don't need to glue the directory
!                name to the results; we've already done it in glob_vector */
!             if ((dflags & GX_ALLDIRS) && filename[0] == '*' && filename[1] == 
'*' && filename[2] == '\0')
!               array = temp_results;
!             else
!               array = glob_dir_to_array (directories[i], temp_results, flags);
              l = 0;
              while (array[l] != NULL)
***************
*** 960,964 ****
  
              /* Note that the elements of ARRAY are not freed.  */
!             free ((char *) array);
            }
        }
--- 963,968 ----
  
              /* Note that the elements of ARRAY are not freed.  */
!             if (array != temp_results)
!               free ((char *) array);
            }
        }
*** ../bash-4.0/patchlevel.h    2009-01-04 14:32:40.000000000 -0500
--- patchlevel.h        2009-02-22 16:11:31.000000000 -0500
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 23
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 24
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]