zsh-users
 help / color / mirror / code / Atom feed
* How to NOT allow LC_COLLATE to corrupt globbing ???
@ 1998-12-07 13:44 Stucki
  1998-12-07 13:57 ` Peter Stephenson
  1998-12-07 16:16 ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: Stucki @ 1998-12-07 13:44 UTC (permalink / raw)
  To: zsh-users

Hi!


Once again I nearly was bitten by an Environment containing:
export LC_COLLATE=de

Then doing 'rm *[A-Z]*' on a Sun is really doing 'rm *'
as there is no difference between upper and lower case
in the german collating sequence.

So now I'd like to ***compile*** my zsh in a way that makes sure
I *always* use the standard collating sequence like LC_COLLATE=C
(or may be LC_COLLATE=us).

Is there a way to configure this in, by editing some config-files ???

(changing 'config.h' *after* running 'configure'
 to contain '#define HAVE_LOCALE_H 0' did *not* help!)

Any ideas ?

Stucki


-- 
Christoph von Stuckrad       * *  | talk to  | <stucki@math.fu-berlin.de> \
Freie Universitaet Berlin    |/_* | nickname | Tel(days):+48 30 838-75 459 |
Fachbereich Mathematik, EDV  |\ * | 'stucki' | Tel(else):+49 30 77 39 6600 |
Arnimallee 2-6/14195 Berlin  * *  |  on IRC  | Fax(alle):+49 30 838-75454 /


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to NOT allow LC_COLLATE to corrupt globbing ???
  1998-12-07 13:44 How to NOT allow LC_COLLATE to corrupt globbing ??? Stucki
@ 1998-12-07 13:57 ` Peter Stephenson
  1998-12-07 16:16 ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 1998-12-07 13:57 UTC (permalink / raw)
  To: Stucki, zsh-users

Stucki wrote:
> So now I'd like to ***compile*** my zsh in a way that makes sure
> I *always* use the standard collating sequence like LC_COLLATE=C
> (or may be LC_COLLATE=us).
> 
> Is there a way to configure this in, by editing some config-files ???
> 
> (changing 'config.h' *after* running 'configure'
>  to contain '#define HAVE_LOCALE_H 0' did *not* help!)

I just reread that and the first thing I'd suggest is not defining
HAVE_LOCALE_H at all, since most of the tests are #ifdef's.

If that's not it, here's what I wrote before I realised what the
problem probably was.

zsh will only ever call setlocale() if LC_ALL is defined, which
usually happens in locale.h; zsh will not define it itself.  So either
the definition is creeping in some other way on your system --- you
could look at the post-prerprocessor output to see what files are
being included --- or the locale you are in is the default one.  If
it's the former you might try sticking #undef LC_ALL at the end of
system.h, since config.h probably gets included too early to do
anything about it without some more detective work.  If it's the
second (which seems pretty unlikely) you can't get away without at
least one call to setlocale().

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to NOT allow LC_COLLATE to corrupt globbing ???
  1998-12-07 13:44 How to NOT allow LC_COLLATE to corrupt globbing ??? Stucki
  1998-12-07 13:57 ` Peter Stephenson
@ 1998-12-07 16:16 ` Bart Schaefer
  1998-12-07 16:44   ` Bruce Stephens
  1 sibling, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 1998-12-07 16:16 UTC (permalink / raw)
  To: Stucki, zsh-users

On Dec 7,  2:44pm, Stucki wrote:
} Subject: How to NOT allow LC_COLLATE to corrupt globbing ???
}
} Once again I nearly was bitten by an Environment containing:
} export LC_COLLATE=de
} 
} Then doing 'rm *[A-Z]*' on a Sun is really doing 'rm *'
} as there is no difference between upper and lower case
} in the german collating sequence.

When we discussed this earlier this year, Zoltan concluded in

http://www.zsh.org/mla/workers/1998/msg00551.html

that GNU regexp and bash don't use the collating sequence in character
ranges, and that it's therefore probably OK for zsh not to either.  Hey,
Tim, any chance you can try ksh in some other language environment to
see if it collates character ranges?

} So now I'd like to ***compile*** my zsh in a way that makes sure
} I *always* use the standard collating sequence like LC_COLLATE=C
} (or may be LC_COLLATE=us).
} 
} (changing 'config.h' *after* running 'configure'
}  to contain '#define HAVE_LOCALE_H 0' did *not* help!)

That's because glob.c calls strcoll() if HAVE_STRCOLL is defined, whether
or not locale.h is present or any other locale macros are defined.  So if
the library strcoll() believes LC_COLLATE, you're going to get collating
behavior.  Contrariwise, if you #undef HAVE_STRCOLL you'll get the rest
of the locale-specific behavior without getting collating sequences.

There are other places where HAVE_STRCOLL is used and might be desirable,
though, so it would really be best to make a decision on glob.c and either
remove the HAVE_STRCOLL code or make it part of the appropriate emulation.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to NOT allow LC_COLLATE to corrupt globbing ???
  1998-12-07 16:16 ` Bart Schaefer
@ 1998-12-07 16:44   ` Bruce Stephens
  0 siblings, 0 replies; 4+ messages in thread
From: Bruce Stephens @ 1998-12-07 16:44 UTC (permalink / raw)
  To: zsh-users

"Bart Schaefer" <schaefer@brasslantern.com> writes:

> Hey, Tim, any chance you can try ksh in some other language
> environment to see if it collates character ranges?

I've just tried ksh93, and it seems to ignore LC_COLLATE in this case,
whereas zsh uses LC_COLLATE.  

I think there's a strong case for changing zsh's behaviour here.
Although I can see why one might want to treat accented letters and
similar things in a locale specific way, ignoring case strikes me as
far worse than doing the wrong thing with accented letters.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1998-12-07 16:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-12-07 13:44 How to NOT allow LC_COLLATE to corrupt globbing ??? Stucki
1998-12-07 13:57 ` Peter Stephenson
1998-12-07 16:16 ` Bart Schaefer
1998-12-07 16:44   ` Bruce Stephens

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).