summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-04-28 20:50:23 +1000
committerHerbert Xu <herbert@gondor.apana.org.au>2007-04-28 20:50:23 +1000
commit4a1c9c120af859665c37fa9d45cbf737c303c06d (patch)
treebdeee27c429f90d51b88f9abec3450baa6f5eb57 /src
parent[BUILTIN] Fixed command -v segmentation fault (diff)
downloaddash-4a1c9c120af859665c37fa9d45cbf737c303c06d.tar.gz
dash-4a1c9c120af859665c37fa9d45cbf737c303c06d.zip
[BUILTIN] Fix mkbuiltin sort order
On Fri, Feb 16, 2007 at 04:24:55PM -0800, Dan Nicholson wrote:
> I was having a problem building dash where `:' wasn't being recognized
> as a builtin command. I won't bore you with the details of the
> debugging, but it came down to the fact that the generated struct in
> builtins.c wasn't being sorted correctly. The ":" name was coming
> before the "." name and then was never able to be found by bsearch().
>
> The issue turned out to be that I was building with a UTF-8 charset,
> causing the `sort' to come out differently from the mkbuiltins script.
> When I finally set LANG=C, it came out correct. Here's an example of
> the difference.
>
> $ LANG=C sort << "EOF"
> :
> .
> EOF
> .
> :
> $ LANG=en_US.ISO-8859-1 sort << "EOF"
> :
> .
> EOF
> :
> .
>
> My system has glibc-2.3.6, but I also tested it on an RHEL3 server at
> work. My solution was just to add LC_ALL=C to the mkbuiltins script.
> Maybe it's overkill to use LC_ALL. Patch against HEAD attached.

I've changed this patch so that we just set LC_COLLATE for the sort
command.
Diffstat (limited to 'src')
-rw-r--r--src/mkbuiltins2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mkbuiltins b/src/mkbuiltins
index f3f91c5..960c61c 100644
--- a/src/mkbuiltins
+++ b/src/mkbuiltins
@@ -65,7 +65,7 @@ awk '{	for (i = 2 ; i <= NF ; i++) {
 		if ($i ~ /^-/)
 			line = $(++i) "\t" line
 		print line
-	}}' $temp | sort -k 1,1 | tee $temp2 | awk '{
+	}}' $temp | LC_COLLATE=C sort -k 1,1 | tee $temp2 | awk '{
 		opt = ""
 		if (NF > 2) {
 			opt = substr($2, 2)