~ubuntu-branches/ubuntu/hardy/dash/hardy-security

« back to all changes in this revision

Viewing changes to debian/diff/0009-BUILTIN-Fix-mkbuiltin-sort-order.diff

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-07-18 15:38:47 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070718153847-pef1uwy72j9gs9pw
Tags: 0.5.4-1ubuntu1
* Merge with Debian; remaining changes:
  - Build against glibc instead of dietlibc
  - Change default answer for "Install dash as /bin/sh?" question to true.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From 4a1c9c120af859665c37fa9d45cbf737c303c06d Mon Sep 17 00:00:00 2001
2
 
From: Herbert Xu <herbert@gondor.apana.org.au>
3
 
Date: Sat, 28 Apr 2007 20:50:23 +1000
4
 
Subject: [PATCH] [BUILTIN] Fix mkbuiltin sort order
5
 
 
6
 
On Fri, Feb 16, 2007 at 04:24:55PM -0800, Dan Nicholson wrote:
7
 
> I was having a problem building dash where `:' wasn't being recognized
8
 
> as a builtin command. I won't bore you with the details of the
9
 
> debugging, but it came down to the fact that the generated struct in
10
 
> builtins.c wasn't being sorted correctly. The ":" name was coming
11
 
> before the "." name and then was never able to be found by bsearch().
12
 
>
13
 
> The issue turned out to be that I was building with a UTF-8 charset,
14
 
> causing the `sort' to come out differently from the mkbuiltins script.
15
 
> When I finally set LANG=C, it came out correct. Here's an example of
16
 
> the difference.
17
 
>
18
 
> $ LANG=C sort << "EOF"
19
 
> :
20
 
> .
21
 
> EOF
22
 
> .
23
 
> :
24
 
> $ LANG=en_US.ISO-8859-1 sort << "EOF"
25
 
> :
26
 
> .
27
 
> EOF
28
 
> :
29
 
> .
30
 
>
31
 
> My system has glibc-2.3.6, but I also tested it on an RHEL3 server at
32
 
> work. My solution was just to add LC_ALL=C to the mkbuiltins script.
33
 
> Maybe it's overkill to use LC_ALL. Patch against HEAD attached.
34
 
 
35
 
I've changed this patch so that we just set LC_COLLATE for the sort
36
 
command.
37
 
---
38
 
 ChangeLog      |    4 ++++
39
 
 src/mkbuiltins |    2 +-
40
 
 2 files changed, 5 insertions(+), 1 deletions(-)
41
 
 
42
 
diff --git a/ChangeLog b/ChangeLog
43
 
index ecaff93..1867b7a 100644
44
 
--- a/ChangeLog
45
 
+++ b/ChangeLog
46
 
@@ -1,3 +1,7 @@
47
 
+2007-04-28  Dan Nicholson <dbn.lists@gmail.com>
48
 
+
49
 
+       * Set LC_COLLATE for sort in mkbuiltin.
50
 
+
51
 
 2006-10-22  Gerrit Pape <pape@smarden.org>
52
 
 
53
 
        * Fixed command -v segmentation fault.
54
 
diff --git a/src/mkbuiltins b/src/mkbuiltins
55
 
index f3f91c5..960c61c 100644
56
 
--- a/src/mkbuiltins
57
 
+++ b/src/mkbuiltins
58
 
@@ -65,7 +65,7 @@ awk '{        for (i = 2 ; i <= NF ; i++) {
59
 
                if ($i ~ /^-/)
60
 
                        line = $(++i) "\t" line
61
 
                print line
62
 
-       }}' $temp | sort -k 1,1 | tee $temp2 | awk '{
63
 
+       }}' $temp | LC_COLLATE=C sort -k 1,1 | tee $temp2 | awk '{
64
 
                opt = ""
65
 
                if (NF > 2) {
66
 
                        opt = substr($2, 2)
67
 
1.5.2.1
68