Re: [PATCHES] C locale sort in src/tools/make_ctags

2004-02-02 Thread Peter Eisentraut
Nicolai Tufar wrote:
  -Original Message-
  From: Peter Eisentraut [mailto:[EMAIL PROTECTED]
 
  LC_ALL overrides LANG, so please just one.

 Don't do it! I just tried it with only LC_ALL and it did not
 work. Same tags file is not sorted error message from vi.

On second look, the patch is completely wrong anyway, because it does 
not export the variables; it depends on the user having exported them 
beforehand.  The correct answer is to remove the LANG assignment and 
add

LC_ALL=C
export LC_ALL

instead.


---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])


Re: [PATCHES] C locale sort in src/tools/make_ctags

2004-02-02 Thread Tom Lane
Peter Eisentraut [EMAIL PROTECTED] writes:
 Nicolai Tufar wrote:
 Don't do it! I just tried it with only LC_ALL and it did not
 work. Same tags file is not sorted error message from vi.

 On second look, the patch is completely wrong anyway, because it does 
 not export the variables; it depends on the user having exported them 
 beforehand.

I saw that, but it seemed a non-problem to me: if the variables have not
been exported then they won't affect the sort program anyway.

I tried to reproduce Nicolai's statement about LC_ALL not being
sufficient, but AFAICT Fedora Core 1 handles this as expected:

$ cat /etc/redhat-release
Fedora Core release 1 (Yarrow)
$ LANG=en_US LC_ALL=en_GB locale
LANG=en_US
LC_CTYPE=en_GB
LC_NUMERIC=en_GB
LC_TIME=en_GB
LC_COLLATE=en_GB
LC_MONETARY=en_GB
LC_MESSAGES=en_GB
LC_PAPER=en_GB
LC_NAME=en_GB
LC_ADDRESS=en_GB
LC_TELEPHONE=en_GB
LC_MEASUREMENT=en_GB
LC_IDENTIFICATION=en_GB
LC_ALL=en_GB
$ cat zzz
abc DEF
ABC DEF
$ LANG=C sort zzz
ABC DEF
abc DEF
$ LANG=en_US sort zzz
abc DEF
ABC DEF
$ LANG=en_US LC_ALL=C sort zzz
ABC DEF
abc DEF


What I suspect is that Nicolai's environment supplies an explicit value
for LC_COLLATE, overriding both LC_ALL and LANG.  If we want to be
bulletproof against that, then none of the proposals in this thread are
correct, and the correct patch is

+ LC_COLLATE=C
+ export LC_COLLATE


regards, tom lane

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [PATCHES] C locale sort in src/tools/make_ctags

2004-02-02 Thread Peter Eisentraut
Tom Lane wrote:
 I saw that, but it seemed a non-problem to me: if the variables have
 not been exported then they won't affect the sort program anyway.

He probably had LANG, but not LC_ALL, already exported in his 
environment.  So when the shell program writes:

LC_ALL=C

then sort doesn't see it, because it is not exported, but LANG is still 
exported with the value he doesn't want.  The solution is to export 
LC_ALL.

 I tried to reproduce Nicolai's statement about LC_ALL not being
 sufficient, but AFAICT Fedora Core 1 handles this as expected:

 $ cat /etc/redhat-release
 Fedora Core release 1 (Yarrow)
 $ LANG=en_US LC_ALL=en_GB locale

You have both LC_ALL and LANG exported.

 What I suspect is that Nicolai's environment supplies an explicit
 value for LC_COLLATE, overriding both LC_ALL and LANG.  If we want to
 be bulletproof against that, then none of the proposals in this
 thread are correct, and the correct patch is

That's not possible, because LC_ALL overrides everything.


---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


[PATCHES] C locale sort in src/tools/make_ctags

2004-02-01 Thread Nicolai Tufar
Greetings,

Attached is a simple one-liner for src/tools/make_ctags.
If tags are sorted in locale other than C, vim complains:

E432: Tags file not sorted: tags

Solution is to set LANG variable to C before calling sort.

Regards,
Nicolai Tufar


ctags-sort.diff
Description: Binary data

---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


Re: [PATCHES] C locale sort in src/tools/make_ctags

2004-02-01 Thread Peter Eisentraut
Nicolai Tufar wrote:
 Greetings,

 Attached is a simple one-liner for src/tools/make_ctags.
 If tags are sorted in locale other than C, vim complains:

 E432: Tags file not sorted: tags

 Solution is to set LANG variable to C before calling sort.

That should be LC_ALL.


---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [PATCHES] C locale sort in src/tools/make_ctags

2004-02-01 Thread Nicolai Tufar
 -Original Message-
 From: Peter Eisentraut [mailto:[EMAIL PROTECTED]
 
 Nicolai Tufar wrote:
  Greetings,
 
  Attached is a simple one-liner for src/tools/make_ctags.
  If tags are sorted in locale other than C, vim complains:
 
  E432: Tags file not sorted: tags
 
  Solution is to set LANG variable to C before calling sort.
 
 That should be LC_ALL.

Sounds fair. Both could be done. It worked for me just with LANG.
Should I submit a new patch?


---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


Re: [PATCHES] C locale sort in src/tools/make_ctags

2004-02-01 Thread Bruce Momjian
Nicolai Tufar wrote:
  -Original Message-
  From: Peter Eisentraut [mailto:[EMAIL PROTECTED]
  
  Nicolai Tufar wrote:
   Greetings,
  
   Attached is a simple one-liner for src/tools/make_ctags.
   If tags are sorted in locale other than C, vim complains:
  
   E432: Tags file not sorted: tags
  
   Solution is to set LANG variable to C before calling sort.
  
  That should be LC_ALL.
 
 Sounds fair. Both could be done. It worked for me just with LANG.
 Should I submit a new patch?

Patch applied to do both.  Thanks.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073
Index: src/tools/make_ctags
===
RCS file: /cvsroot/pgsql-server/src/tools/make_ctags,v
retrieving revision 1.7
diff -c -c -r1.7 make_ctags
*** src/tools/make_ctags18 Jan 2003 06:06:51 -  1.7
--- src/tools/make_ctags1 Feb 2004 23:10:42 -
***
*** 10,15 
--- 10,17 
  find `pwd`/ \( -name _deadcode -a -prune \) -o \
-type f -name '*.[chyl]' -print|xargs ctags $FLAGS -a -f tags
  
+ LANG=C
+ LC_ALL=C
  sort tags /tmp/$$  mv /tmp/$$ tags
  
  find . -name  'CVS' -prune -o -type d -print  |while read DIR

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html