This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2/1][BZ #866] glob() should match dangling symlinks.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Mike Frysinger <vapier at gentoo dot org>
- Cc: libc-alpha at sourceware dot org, glibc at tomlee dot co
- Date: Fri, 3 Jan 2014 00:39:48 +0100
- Subject: Re: [PATCH 2/1][BZ #866] glob() should match dangling symlinks.
- Authentication-results: sourceware.org; auth=none
- References: <20131003075937 dot GA22576 at domone dot podge> <20131012082529 dot GA12308 at domone dot podge> <201401021704 dot 30170 dot vapier at gentoo dot org>
On Thu, Jan 02, 2014 at 05:04:29PM -0500, Mike Frysinger wrote:
> On Saturday 12 October 2013 04:25:29 OndÅej BÃlka wrote:
> > This is another bug in glob with patch in bugzilla from Tom Lee ready,
> > see https://sourceware.org/bugzilla/show_bug.cgi?id=866
> >
> > Patch itself is ok, what is left is decide if listing dangling symlinks
> > is desired behavior.
>
> it is desired behavior
>
> > --- a/posix/glob.c
> > +++ b/posix/glob.c
> > @@ -204,7 +204,7 @@ static const char *next_brace_sub (const char *begin,
> > int flags) __THROW;
> >
> > static int glob_in_dir (const char *pattern, const char *directory,
> > int flags, int (*errfunc) (const char *, int),
> > - glob_t *pglob, size_t alloca_used);
> > + glob_t *pglob, size_t alloca_used, int chklnks);
> > extern int __glob_pattern_type (const char *pattern, int quote)
> > attribute_hidden;
> >
> > @@ -1078,7 +1078,7 @@ glob (pattern, flags, errfunc, pglob)
> > status = glob_in_dir (filename, dirs.gl_pathv[i],
> > ((flags | GLOB_APPEND)
> > & ~(GLOB_NOCHECK | GLOB_NOMAGIC)),
> > - errfunc, pglob, alloca_used);
> > + errfunc, pglob, alloca_used, 1);
>
> what is this scenario where we're still checking the links ?
>
Rationale was not match dangling symlinks when matching directories like
glob ("*/", ...)
I do not remember exact logic now, glob code takes quite bit of effort
to track what happens there.
> also, globtest.sh needs updating to make sure this new behavior doesn't
> regress
> -mike
I send a updated testcase in followup thread, glob is also tested in
tst-gnuglob.c bug-glob[123].c and I modified bug-glob3.c which
previously failed to match current behaviour.