bin/56558: [PATCH] locate(1) cannot be safely used with xargs(1)

FUJISHIMA Satsuki sf at FreeBSD.org
Fri Sep 12 05:15:29 PDT 2003


At Thu, 11 Sep 2003 22:20:16 -0700 (PDT),
Eugene Grosbein wrote:
>  > command | tr '\n' '\0' | xargs -0 foo
>  > would work for any commands, not limited to locate(1).
>  
>  It will break when filename contains '\n' that is allowed.

Don't worry.

If our locate(1) is implemented enough to satisfy its manpage, it
does not store newline and NUL into DB. Actually, any input will be
chopped by '\n'. So you would never get unexpected newline.

quoted from locate(1):
     Historically, locate only stored characters between 32 and 127.  The cur-
     rent implementation store any character except newline (`\n') and NUL
     (`\0'). (...)


More information about the freebsd-bugs mailing list