Link [ pkgsrc | NetBSD | pkgsrc git mirror | PR fulltext-search | netbsd commit viewer ]


   
        usage: [branch:branch] [user:user] [path[@revision]] keyword [... [-excludekeyword [...]]] (e.g. branch:MAIN pkgtools/pkg)




switch to index mode

recent branches: MAIN (7m)  pkgsrc-2024Q1 (3d)  pkgsrc-2023Q4 (77d)  pkgsrc-2023Q2 (110d) 

2024-06-17 13:31:08 UTC Now

2008-01-18 11:16:08 UTC MAIN commitmail json YAML

Don't rely on file(1) to distinguish text files from binary files. This
has proven too unreliable in the past. For example, some Makefile.in
files were classified as "Quake I or II world or extension", just
because they happen to start with the letters "PACK". This method was
also subject to subtle differences in the locale.

The new method counts the number of NUL bytes in the file. It does not
depend on the locale settings. The -c option of wc(1) counts bytes, not
characters, and tr(1), which may interpret multibyte sequences, is
protected by LC_ALL. It should also work with the historical
implementations of tr(1) that could not handle NUL bytes and discarded
them, since this is exactly the intention.

See also:
* http://mail-index.netbsd.org/tech-pkg/2006/07/05/0000.html
* PR 37793

(rillig)