Subject: pkgsrc's locale-dependent behavior breaks things
To: NetBSD Packages Technical Discussion List <tech-pkg@netbsd.org>
From: Roland Illig <rillig@NetBSD.org>
List: tech-pkg
Date: 07/05/2006 05:52:30
Hi,
pkgsrc does not handle locales very well. For example the call to
file(1) in mk/subst.mk is done in the locale of the pkgsrc user, which
is the cause for PR 28769.
The "hacky" solution here would be to prefix the call to file(1) with
${SETENV} ${SANE_ENV} (SANE_ENV does not yet exist, but it surely would
include correct locale settings). This would just be a one-point fix,
leaving more bugs in the rest of the code.
A second example is when sort(1) is used in one of the do-* targets on
Solaris, since that tool sorts the lines case-insensitively when the
locale's languages is not "C". On the other hand, if sort(1) is called
from inside the default do-build target, the locale settings are correct.
These two cases make pkgsrc pretty inconsistent and unpredictable, since
at some places the sane "C" locale settings are used and at some others
they are not. To resolve this, I suggest to introduce a variable
SANE_ENV or SANE_ENV_CMD like above that defines a sane environment.
This may include even unsetting DISPLAY, removing "." from the PATH and
many more things. For most things, SANE_ENV should suffice, but having a
way of undefining environment variables would surely be nice to have,
too. So maybe instead of SANE_ENV we even need the flexibility of
SANE_ENV_CMD.
Roland