Subject: Re: [PATCH] t9129: fix UTF-8 locale detection

From: Yann Droneaud <[email-masked]>
Date: Tue, 18 May 2010 22:49:57 +0200

Le mardi 18 mai 2010 à 10:45 -0700, Linus Torvalds a écrit :
> 
> On Tue, 18 May 2010, Yann Droneaud wrote:
> >  
> > -if locale -a |grep -q en_US.utf8; then
> > +if locale -a |grep -qE '^en_US\.(utf|UTF)-?8$'; then
> 
> While -E is POSIX, I suspect that it's not universal. iirc, you still have 
> some really crap fileutils tools coming with Solaris, for example. 
> 

You're right, Solaris's own grep doesn't known about -E nor -e.

And it even doesn't know about -q : 

 $ grep -q                                                     
 grep: illegal option -- q
 Usage: grep -hblcnsviw pattern file . . .

So the whole test won't work for older Solaris.

Solaris don't support grep -e, but has the non POSIX egrep instead
(which doesn't support -q too).

[...]

> I'm also not entirely sure you want to make that pattern stricter - the 
> whole problem with the old pattern was that it was too exact, so why add 
> the beginning/end requirement?
> 

Just to be sure it doesn't match "garbage". 
Initial regexp was using a straight '.' operator, so while fixing it, I
thought it would be better to achieve "perfect match".

Regards.

-- 
Yann Droneaud