7 Bug-Reported-by: Matt Zyzik <matt.zyzik@nyu.edu>
8 Bug-Reference-ID: <20090519011418.GA21431@ice.filescope.com>
9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-05/msg00044.html
13 bash40-024 introduced a regression for constructs like **/*.cs; that
14 expansion would no longer include matching files in the current directory.
15 This patch undoes portions of bash40-024 and fixes the original problem
20 *** ../bash-4.0-patched/lib/glob/glob.c 2009-05-22 12:32:26.000000000 -0400
21 --- lib/glob/glob.c 2009-05-22 12:35:55.000000000 -0400
26 ! /* compat: if GX_ALLDIRS, add the passed directory also, but don't add an
27 ! empty directory name. */
28 ! if (add_current && (flags & GX_NULLDIR) == 0)
34 ! /* compat: if GX_ADDCURDIR, add the passed directory also. Add an empty
35 ! directory name as a placeholder if GX_NULLDIR (in which case the passed
36 ! directory name is "."). */
42 nextlink->next = lastlink;
44 ! bcopy (dir, nextname, sdlen + 1);
48 nextlink->next = lastlink;
50 ! if (flags & GX_NULLDIR)
53 ! bcopy (dir, nextname, sdlen + 1);
58 /* Just return what glob_vector () returns appended to the
60 dflags = flags & ~GX_MARKDIRS;
61 if (directory_len == 0)
63 if ((flags & GX_GLOBSTAR) && filename[0] == '*' && filename[1] == '*' && filename[2] == '\0')
64 ! dflags |= GX_ALLDIRS|GX_ADDCURDIR;
65 temp_results = glob_vector (filename,
66 (directory_len == 0 ? "." : directory_name),
68 /* Just return what glob_vector () returns appended to the
70 + /* If flags & GX_ALLDIRS, we're called recursively */
71 dflags = flags & ~GX_MARKDIRS;
72 if (directory_len == 0)
74 if ((flags & GX_GLOBSTAR) && filename[0] == '*' && filename[1] == '*' && filename[2] == '\0')
76 ! dflags |= GX_ALLDIRS|GX_ADDCURDIR;
78 ! /* If we want all directories (dflags & GX_ALLDIRS) and we're not
79 ! being called recursively as something like `echo **/*.o'
80 ! ((flags & GX_ALLDIRS) == 0), we want to prevent glob_vector from
81 ! adding a null directory name to the front of the temp_results
82 ! array. We turn off ADDCURDIR if not called recursively and
85 ! if (directory_len == 0 && (flags & GX_ALLDIRS) == 0)
86 ! dflags &= ~GX_ADDCURDIR;
88 temp_results = glob_vector (filename,
89 (directory_len == 0 ? "." : directory_name),
90 *** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
91 --- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
94 looks for to find the patch level (for the sccs version string). */
96 ! #define PATCHLEVEL 24
98 #endif /* _PATCHLEVEL_H_ */
100 looks for to find the patch level (for the sccs version string). */
102 ! #define PATCHLEVEL 25
104 #endif /* _PATCHLEVEL_H_ */