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

Bug#314717: [locales] Maintainer scripts may misbehave under et_EE locale



Package: locales
Version: 2.3.2.ds1-21
Severity: normal
Tags: patch

This patch prepends LC_ALL=C to locale-dependent commands.
With et_EE locale, z is sorted after s, so it is not the last letter:
  $ echo pqrstuvwxyz | LC_ALL=C sed -e 's/[a-z]//g'

  $ echo pqrstuvwxyz | LC_ALL=et_EE sed -e 's/[a-z]//g'
  tuvwxy

Denis
Index: debhelper.in/locales.config
===================================================================
--- debhelper.in/locales.config	(revision 932)
+++ debhelper.in/locales.config	(working copy)
@@ -15,7 +15,7 @@
     #  With current implementation, this string has to be removed.
     grep -q "Leave alone" $LG && sed -e '/^Leave alone/d' $LG > $LG.tmp && mv $LG.tmp $LG
 
-    SELECTED_LOCALES=$(sed -e '/^[a-zA-Z]/!d' $LG | tr '\n' ',' | sed -e 's/,/, /g' -e 's/, *$//')
+    SELECTED_LOCALES=$(LC_ALL=C sed -e '/^[a-zA-Z]/!d' $LG | tr '\n' ',' | sed -e 's/,/, /g' -e 's/, *$//')
     db_set locales/locales_to_be_generated "${SELECTED_LOCALES}"
 else
     LG=/dev/null
@@ -29,7 +29,7 @@
 #   Add a newline in case /etc/locale.gen has no trailing newline at EOF
 SUPPORTED_LOCALES="
 __SUPPORTED_LOCALES__"
-SUPPORTED_LOCALES=$( (cat $LG && echo "$SUPPORTED_LOCALES") | sed -e '/^[a-zA-Z]/!d' | sort -u | tr '\n' ',' | sed -e 's/,/, /g' -e 's/, *$//')
+SUPPORTED_LOCALES=$( (cat $LG && echo "$SUPPORTED_LOCALES") | LC_ALL=C sed -e '/^[a-zA-Z]/!d' | LC_ALL=C sort -u | tr '\n' ',' | sed -e 's/,/, /g' -e 's/, *$//')
 db_subst locales/locales_to_be_generated locales "${SUPPORTED_LOCALES}"
 
 STATE=1
Index: debhelper.in/locales.postinst
===================================================================
--- debhelper.in/locales.postinst	(revision 932)
+++ debhelper.in/locales.postinst	(working copy)
@@ -15,7 +15,7 @@
     if [ -n "$SELECTED_LOCALES" ]; then
         if [ -e $LG ]; then
             #   Comment previous defined locales
-            sed -e 's/^[a-zA-Z]/#&/' $LG > $LG.tmp || true
+            LC_ALL=C sed -e 's/^[a-zA-Z]/#&/' $LG > $LG.tmp || true
             mv -f $LG.tmp $LG
 	    last=`tail -n 1 "$LG"`
 	    if test -n "$last"; then echo >> $LG; fi
@@ -45,7 +45,7 @@
         IFS=$save_IFS
     else
         if [ -e $LG ]; then
-            sed -e 's/^[a-zA-Z]/#&/' $LG > $LG.tmp || true
+            LC_ALL=C sed -e 's/^[a-zA-Z]/#&/' $LG > $LG.tmp || true
             mv -f $LG.tmp $LG
         fi
     fi

Reply to: