Scott Cheloha wrote: > > On Jan 10, 2019, at 14:35, Jan Stary <h...@stare.cz> wrote: > > > > Does locate(1) need to setlocale(3)? > > locate(1) uses tolower(3), the results of which can be affected by > locale settings. locate(1)'s database is, at least in theory, portable. > If you don't explicitly set the locale to POSIX/C I think it might be > possible to create a corrupted database, or read a valid database > as corrupted.
Speaking of portability... man locate says: The locate database is not byte order independent. It is not possible to share the databases between machines with different byte order. The current locate implementation understands databases in host byte order or network byte order. So a little-endian machine can't understand a locate database which was built on a big-endian machine. That doesn't really make sense. If it understands network byte order, then it can read big endian databases. And then there's this comment in the source: * Convert network byte order to host byte order if necessary. * So we can read on FreeBSD/i386 (little endian) a locate database * which was built on SunOS/sparc (big endian). So there's a little mystery to unravel for somebody with multiple CPUs. Does it work or not?