[Top][All Lists]

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

Interpretation of locate -r in various locate implementations

From: James Youngman
Subject: Interpretation of locate -r in various locate implementations
Date: Tue, 25 Mar 2008 11:05:02 +0000

I understand that "locate -r" works differently between GNU locate on
the one hand, and both mlocate and slocate on the other.     GNU
locate uses Emacs-dialect regular expressions.   Both mlocate and
slocate use POSIX BREs.

(Although the GNU locate manual page states that "." will match a
newline and that was a deliberate design decision, I notice that the
actual code doesn't do that:

$ printf "hello\nworld\n" > x; ./frcode -0  < x > x.db; for re in
".*hello." ".*hello"; do echo "$re"; ./locate -0  -r "$re" -d ./x.db
| od -c; done; rm -f x x.db
0000000   h   e   l   l   o  \n   w   o   r   l   d  \0

This is a bug.   The divergence between the code and the manual page
needs to be fixed.  At least one must change.
The Texinfo manual doesn't yet mention newlines in the context of "locate -r".

Anyway, on the one hand this divergence of interpretation of regular
expressions is unlikely to be convenient for users, but on the other I
believe it should be possible for tools to correctly handle white
space, even newlines, in file names.    As the community of users of
GNU locate, what are your preferences?


reply via email to

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