[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#277073: Patch to really fix this bug



On Tue, Jun 28, 2005 at 06:39:31AM +0200, Christian Perrier wrote:
> Matt Kraai wrote:
> > The previous test checks whether $LOCALE is not equal to C.  Could
> > your new clause be simplified to
> > 
> >  if [ "$LOCALE" != C -a \( "$LOCALE" != en_US -o "$ARCH" = powerpc \) ]; then
> >    pkginstall localization-config
> >  fi
> 
> Barely, yes. I have to admit that I was missing the exact appropriate
> syntax for conditional grouping in test...especially escaping the
> parentheses...

That syntax is best avoided altogether; it's non-portable and highly
confusing, especially if you try to work out how it's supposed to behave
from the specification. Instead:

  if [ "$LOCALE" != C ] && ([ "$LOCALE" != en_US ] || [ "$ARCH" = powerpc ]); then
    ...
  fi

> However, the test should IMHO not be on LOCALE for en_US because in
> that case LOCALE could be en_US.UTF-8 or en_US.ISO-8859-1 as well as
> en_US alone and we probably don't want l-c to be installed there as
> well. So, the test becomes:
> 
> if [ "$LOCALE" != C -a \
>       \( \
>          \( "$LANGUAGE" != en -o "$COUNTRYCODE" != US \) \
>          -o "$ARCH" = powerpc \
>       \) \
>    ]; then

  if [ "$LOCALE" != C ] && \
     ([ "$LANGUAGE" != en ] || [ "$COUNTRYCODE" != US ] || \
      [ "$ARCH" = powerpc ]); then
    ...
  fi

It involves a few more processes, but it's worth it.

Cheers,

-- 
Colin Watson                                       [cjwatson@debian.org]



Reply to: