[klibc] [klibc:update-dash] builtin: Clear LC_ALL in mkbuiltins

klibc-bot for Fredrik Fornwall fredrik at fornwall.net
Thu Jan 24 19:15:36 PST 2019


Commit-ID:  494b05615ac00f171290175bed6ea065d0900818
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=494b05615ac00f171290175bed6ea065d0900818
Author:     Fredrik Fornwall <fredrik at fornwall.net>
AuthorDate: Sun, 24 May 2015 23:05:48 +0200
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Fri, 25 Jan 2019 02:57:21 +0000

[klibc] builtin: Clear LC_ALL in mkbuiltins

In mkbuiltins LC_COLLATE is set, but since "The value of the LC_ALL
environment variable has precedence over any of the other environment
variables starting with LC_"
(http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html), this
has no effect when LC_ALL is set.

This breaks when having e.g. LC_ALL=en_US.UTF-8 during make, which
causes the test case
    dash -c :
to fail, probably due to broken ordering in builtins.c. The patch
corrects that by clearing LC_ALL.

Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 usr/dash/mkbuiltins | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/usr/dash/mkbuiltins b/usr/dash/mkbuiltins
index f412a41b..8c74d6b1 100644
--- a/usr/dash/mkbuiltins
+++ b/usr/dash/mkbuiltins
@@ -78,7 +78,7 @@ awk '{	for (i = 2 ; i <= NF ; i++) {
 		if ($i ~ /^-/)
 			line = $(++i) "\t" line
 		print line
-	}}' $temp | LC_COLLATE=C sort -k 1,1 | tee $temp2 | awk '{
+	}}' $temp | LC_ALL= LC_COLLATE=C sort -k 1,1 | tee $temp2 | awk '{
 		opt = ""
 		if (NF > 2) {
 			opt = substr($2, 2)
@@ -97,8 +97,9 @@ cat <<\!
  */
 
 !
-sed 's/	-[a-z]*//' $temp2 | nl -b a -v 0 | LC_COLLATE=C sort -u -k 3,3 |
-tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |
+sed 's/	-[a-z]*//' $temp2 | nl -b a -v 0 |
+	LC_ALL= LC_COLLATE=C sort -u -k 3,3 |
+	tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |
 	awk '{	printf "#define %s (builtincmd + %d)\n", $3, $1}'
 printf '\n#define NUMBUILTINS %d\n' $(wc -l < $temp2)
 echo '


More information about the klibc mailing list