Package: locales
Version: 2.38-10
Severity: normal
Tags: newcomer, patch


The perl script update-local internally invokes 'locale charmap' to perform 
additional checks.

However if this call fails for some reason, update-locale always only prints 
"Error: invalid locale settings: LANG=...." which can be very misleading when 
the root-cause is actually different.


I.e. sample output of "sudo /usr/sbin/update-locale LANG=de_AT.UTF-8" on Debian 
Trixie:

----
*** update-locale: Error: invalid locale settings:  LANG=de_AT.UTF-8
----


After applying the following patch:

==========
--- /usr/update-locale  2024-05-13 23:42:46.584127893 +0200
+++ /usr/sbin/update-locale     2024-05-13 23:40:25.160121142 +0200
@@ -88,7 +88,7 @@
 {
        #  Check that this locale does exist
        my $charset = `LANG= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= 
LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= 
LC_MEASUREMENT= LC_IDENTIFICATION= LC_ALL= $env locale charmap 2>&1`;
-       die "*** $progname: Error: invalid locale settings: $env\n"
+       die "*** $progname: Error: invalid locale settings: 
$env\n\n----------$charset----------\n"
                if ($charset =~ m/Cannot set/);
        #  If LANGUAGE is set, its first value must be compatible with 
LC_MESSAGES
        if (defined $arg{LANGUAGE})
==========


The output contains the actual information why the call to "locale chaarmap" 
failed, thus making it possible to investigate why the call actually failed:

=======
*** update-locale: Error: invalid locale settings:  LANG=de_AT.UTF-8

----------locale: Cannot set LC_CTYPE to default locale: No such file or 
directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
ANSI_X3.4-1968
----------
=======



-- System Information:
Debian Release: trixie/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.5.0-2-amd64 (SMP w/2 CPU threads; PREEMPT)
Locale: LANG=de_AT.UTF-8, LC_CTYPE=C.UTF-8 (charmap=locale: Cannot set 
LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages locales depends on:
ii  debconf [debconf-2.0]  1.5.86
ii  libc-bin               2.38-10
ii  libc-l10n              2.38-10

locales recommends no packages.

locales suggests no packages.

-- debconf information:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LC_TIME = "de_AT.UTF-8",
        LC_MONETARY = "de_AT.UTF-8",
        LC_CTYPE = "C.UTF-8",
        LC_ADDRESS = "de_AT.UTF-8",
        LC_TELEPHONE = "de_AT.UTF-8",
        LC_NAME = "de_AT.UTF-8",
        LC_MEASUREMENT = "de_AT.UTF-8",
        LC_IDENTIFICATION = "de_AT.UTF-8",
        LC_NUMERIC = "de_AT.UTF-8",
        LC_PAPER = "de_AT.UTF-8",
        LANG = "de_AT.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
  locales/locales_to_be_generated:
  locales/default_environment_locale: None

Reply via email to