Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Sep 2003 21:15:30 +0900
From:      FUJISHIMA Satsuki <sf@FreeBSD.org>
To:        Eugene Grosbein <eugen@kuzbass.ru>
Cc:        freebsd-bugs@FreeBSD.org
Subject:    Re: bin/56558: [PATCH] locate(1) cannot be safely used with xargs(1)
Message-ID:  <86d6e6qk2l.wl@gray.plala.or.jp>
In-Reply-To: <200309120520.h8C5KGNV016093@freefall.freebsd.org>
References:  <200309120520.h8C5KGNV016093@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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'). (...)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86d6e6qk2l.wl>