Package: svgalib
Severity: normal
Tags: patch
Hi,
[a-z] may not represent all 26 ASCII lowercase letters in regular
expressions, eg. Estonian collation sorts z between s and t:
$ echo rstuvwxyz | LC_ALL=en_US.UTF-8 sed -e 's/[a-z]//g'
$ echo rstuvwxyz | LC_ALL=et_EE.UTF-8 sed -e 's/[a-z]//g'
tuvwxy
As shown above, this applies to sed, but also awk, grep, expr
$ echo tuv | LC_ALL=et_EE.UTF-8 awk '/[a-z]/ {print}'
$ echo tuv | LC_ALL=et_EE.UTF-8 grep [a-z]
$ LC_ALL=et_EE.UTF-8 expr tuv : [a-z]
$
and many more.
On the other hand, some commands always work with C collation rules,
most notably tr:
$ echo 1rstuvwxyz2 | LC_ALL=et_EE.UTF-8 tr -d a-z
12
or perl and python if they are not told to switch to user's locale.
One must then switch to C locale to avoid those collation issues,
see attached patch.
Thanks
Denis
diff -ru debian.orig/libsvga1.prerm debian/libsvga1.prerm
--- debian.orig/libsvga1.prerm 2005-12-16 13:35:07.000000000 +0100
+++ debian/libsvga1.prerm 2005-12-16 13:36:22.000000000 +0100
@@ -17,7 +17,7 @@
CONFFILE=/etc/vga/libvga.config
if [ -f "$CONFFILE" -a ! -f "$MOUSEFILE" ] &&
- MOUSELINE=`sed '/^mouse [A-Za-z0-9]*$/I!d;q' "$CONFFILE"` &&
+ MOUSELINE=`LC_ALL=C sed '/^mouse [A-Za-z0-9]*$/I!d;q' "$CONFFILE"` &&
[ "$MOUSELINE" != 'mouse unconfigured' ]; then
cat << EOF > "$MOUSEFILE"
# This file contains your mouse type setting, which is preserved