Bug#207199: locales: locale-gen should complain about malformed /etc/locale.gen files
tags 207199 + patch
thanks
Here is a patch to fix this problem. It teaches the script to ignore
empty lines, and to write an error if the line don't have at least two
words.
This is the output when I tested it
Generating locales...
error: Bad entry 'en_US.ISO-8859-1 '
error: Bad entry 'en_US.UTF-8 '
Generation complete.
--- /usr/sbin/locale-gen 2003-10-28 23:07:31.000000000 +0000
+++ /tmp/locale-gen 2004-04-17 22:20:41.000000000 +0000
@@ -17,10 +17,19 @@
umask 022
+is_entry_ok() {
+ if [ -n "$locale" -a -n "$charset" ] ; then
+ true
+ else
+ echo "error: Bad entry '$locale $charset'"
+ false
+ fi
+}
+
echo "Generating locales..."
while read locale charset; do \
- case $locale in \#*) continue;; esac; \
- [ -n "$locale" -a -n "$charset" ] || continue
+ case $locale in \#*) continue;; "") continue;; esac; \
+ is_entry_ok || continue
echo -n " `echo $locale | sed 's/\([^.\@]*\).*/\1/'`"; \
echo -n ".$charset"; \
echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
Reply to: