[Top][All Lists]

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

Re: Glob fix in locate.c

From: Andreas Metzler
Subject: Re: Glob fix in locate.c
Date: Sun, 13 Jun 2004 10:20:03 +0200
User-agent: Mutt/1.5.6i

On 2004-06-13 Russell Shaw <address@hidden> wrote:
> Andreas Metzler wrote:
> >On 2004-06-12 Russell Shaw <address@hidden> wrote:
> >[...]

> >>I found that locate tries to match against full path
> >>names.

> >This is a feature, not a bug.

> Why? How is locate usually used? Isn't the purpose of locate
> for finding known file-name patterns that have an unknown path?

e.g. I frequently use "locate bin/bar" to find all programs ("bin/"
matches /sbin/ /usr/bin, ...) whose name starts with bar. (I do not
have the sbin dirs in $PATH, which is why I cannot use "which". (Now
that I've looked at the source I am aware that your patch would not
break that, as it only comes into play if wildcards are used.)

I agree that wildcards are broken, e.g. "bin/find" finds
"/usr/bin/find" but "bin*find" won't, which is a bug because the
documentation states that it should work. ;-)
| Therefore, a  pattern ‘foo*bar’  can match  a file name that
| contains ‘foo3/bar’".

Instead of limiting wild-card use to matching only the filename I'd
propose to try to match "*pattern*" if the pattern contained wildcards
and "pattern" did not fnmatch().
                cu andreas

"See, I told you they'd listen to Reason," [SPOILER] Svfurlr fnlf,
fuhggvat qbja gur juveyvat tha.
Neal Stephenson in "Snow Crash"

reply via email to

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