Bug#1066887: locales/locale-gen: Locales Cannot Copy from Locales in /usr/local/share/i18n/locales
Package: locales
Version: 2.36-9+deb12u4
Severity: important
Tags: l10n
X-Debbugs-Cc: maddes+debian@maddes.net
Dear Maintainer,
referencing a custom locale that resides in /usr/local/share/i18n/loaces/ via "copy" doesn't work.
`dpkg-reconfigure locales` gives the following error message:
en_GB.UTF-8@INTL...[error] cannot open locale definition file `en_US@INTL': No such file or directory
Both locales will get attached to the bug, so you can be reproduce.
* What led up to the situation?
Created custom locales in /usr/local/share/i18n/locales/ and wanted
to copy from one those custome locales: en_GB@INTL shall copy LC_TIME from en_US@INTL.
* What exactly did you do (or not do) that was effective (or
ineffective)?
Looked around and recognized that locale-gen doesn't pass any I18NPATH to localedef. So only the compiled-in single path /usr/share/i18n/locales/ is referenced.
* What was the outcome of this action?
Referencing custom locales without I18NPATH does not work (see error message above).
* What outcome did you expect instead?
Referencing a custom locale should work out of the box.
* Workarounds?
This worked: `I18NPATH=/usr/local/share/i18n dpkg-reconfigure locales`
* Possible solutions?
Option #1: Enhance `locale-gen` to set I18NPATH when calling localedef
TESTED and working, allows to set I18NPATH also from the outside.
/usr/sbin/locale-gen:
...
if [ -z "${I18NPATH:-}" ]; then
if [ -d "${USER_LOCALES}" ]; then
I18NPATH="${USER_LOCALES%/locales}"
fi
fi
echo "Generating locales (this might take a while)..."
while read -r locale charset; do
...
I18NPATH="${I18NPATH}" localedef ...
...
done
Option #2: Enhance `localedef` upstream to allow collon separated list of paths via LOCSRCDIR macro
There are no changes since glibc 2.36 in function locfile_read() of locale/programs/locfile.c and no debian patches for this function.
Something like this should work (UNTESTED!):
int
locfile_read (struct localedef_t *result, const struct charmap_t *charmap)
{
...
/* Test in the default directories. */
if (ldfile == NULL)
{
char *locpath = LOCSRCDIR;
const size_t pathlen = strlen (locpath);
char locpathbuf[pathlen + 1];
char path[strlen (filename) + 1 + pathlen];
char *next;
locpath = memcpy (locpathbuf, locpath, pathlen + 1);
while (ldfile == NULL
&& (next = strsep (&locpath, ":")) != NULL)
{
stpcpy (stpcpy (path, next), filename);
ldfile = lr_open (path, locfile_hash);
if (ldfile == NULL)
{
stpcpy (stpcpy (stpcpy (path, next), "/"), filename);
ldfile = lr_open (path, locfile_hash);
}
}
}
...
-- System Information:
Debian Release: 12.5
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 6.1.0-9-amd64 (SMP w/1 CPU thread; PREEMPT)
Locale: LANG=en_US.UTF-8@INTL, LC_CTYPE=en_US.UTF-8@INTL (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages locales depends on:
ii debconf [debconf-2.0] 1.5.82
ii libc-bin 2.36-9+deb12u4
ii libc-l10n 2.36-9+deb12u4
locales recommends no packages.
locales suggests no packages.
-- debconf information:
* locales/locales_to_be_generated: en_DE.UTF-8@INTL UTF-8, en_US.UTF-8 UTF-8, en_US.UTF-8@INTL UTF-8
* locales/default_environment_locale: en_US.UTF-8@INTL
comment_char %
escape_char /
% INTL English locale for US
% This is a modified copy of "en_US"
% Modifications done for internationally working people: ISO date, 24h clock, comma as decimal separator, A4 paper, metric system, etc.
% Most settings are either directly copied from en_US or from i18n
% Special cases are explicitly mentioned
% "en_US" is part of the GNU C Library and contains locale data.
% The Free Software Foundation does not claim any copyright interest
% in the locale data contained in this file. The foregoing does not
% affect the license of the GNU C Library as a whole. It does not
% exempt you from the conditions of the license if your use would
% otherwise be governed by that license.
LC_IDENTIFICATION
title "INTL English locale for US (based on en_US)"
source "Maddes (based on the work of Free Software Foundation, Inc.)"
address "http:////www.github.com//maddes-b//linux-stuff//"
contact ""
email ""
tel ""
fax ""
language "American English"
territory "United States"
revision "1.0"
date "2024-03-12"
category "i18n:2012";LC_IDENTIFICATION
category "i18n:2012";LC_CTYPE
category "i18n:2012";LC_COLLATE
category "i18n:2012";LC_TIME
category "i18n:2012";LC_NUMERIC
category "i18n:2012";LC_MONETARY
category "i18n:2012";LC_MESSAGES
category "i18n:2012";LC_PAPER
category "i18n:2012";LC_NAME
category "i18n:2012";LC_ADDRESS
category "i18n:2012";LC_TELEPHONE
category "i18n:2012";LC_MEASUREMENT
END LC_IDENTIFICATION
LC_CTYPE
copy "en_US"
END LC_CTYPE
LC_COLLATE
copy "en_US"
END LC_COLLATE
LC_MONETARY
% -- taken from en_US
int_curr_symbol "USD "
currency_symbol "$"
mon_decimal_point "," % INTL: adapted
mon_thousands_sep "." % INTL: adapted
mon_grouping 3;3
positive_sign ""
negative_sign "-"
int_frac_digits 2
frac_digits 2
p_cs_precedes 1
int_p_sep_by_space 1
p_sep_by_space 0
n_cs_precedes 1
int_n_sep_by_space 1
n_sep_by_space 0
p_sign_posn 1
n_sign_posn 1
END LC_MONETARY
LC_NUMERIC
% -- taken from en_US
decimal_point "," % INTL: adapted
thousands_sep "." % INTL: adapted
grouping 3;3
END LC_NUMERIC
LC_TIME
% -- taken from en_US/en_GB
abday "Sun";"Mon";"Tue";"Wed";"Thu";"Fri";"Sat"
day /
"Sunday";/
"Monday";/
"Tuesday";/
"Wednesday";/
"Thursday";/
"Friday";/
"Saturday"
abmon /
"Jan";"Feb";/
"Mar";"Apr";/
"May";"Jun";/
"Jul";"Aug";/
"Sep";"Oct";/
"Nov";"Dec"
mon /
"January";/
"February";/
"March";/
"April";/
"May";/
"June";/
"July";/
"August";/
"September";/
"October";/
"November";/
"December"
% Appropriate 12h clock time representation (%r)
am_pm "AM";"PM"
t_fmt_ampm "%I:%M:%S %p %Z" % INTL: adapted
% -- taken/adapted from i18n
% This is the ISO/IEC 14652 "i18n" definition for
% the LC_TIME category.
%
% Weekday and week numbering according to ISO 8601 % INTL: adapted
% https://sourceware.org/glibc/wiki/Locales#LC_TIME
% glibc <=2.36: needs to be based on Sunday
week 7;19971130;4
first_weekday 2
first_workday 2
% week 7;19971201;4
% first_weekday 1
% first_workday 1
% Date formats following ISO 8601
% Appropriate date and time representation (%c)
d_t_fmt "%F %T %Z" % INTL: adapted
%
% Appropriate date representation (%x)
d_fmt "%F"
%
% Appropriate time representation (%X)
t_fmt "%T %Z" % INTL: adapted
%
% Appropriate date representation (date(1))
date_fmt "%a %F %T %Z" % INTL: adapted
END LC_TIME
LC_MESSAGES
copy "en_US"
END LC_MESSAGES
LC_PAPER
copy "i18n"
END LC_PAPER
LC_NAME
copy "en_US"
END LC_NAME
LC_ADDRESS
copy "en_US"
END LC_ADDRESS
LC_TELEPHONE
copy "en_US"
END LC_TELEPHONE
LC_MEASUREMENT
copy "i18n"
END LC_MEASUREMENT
comment_char %
escape_char /
% INTL English locale for GB
% This is a modified copy of "en_GB"
% Modifications done for internationally working people: ISO date, 24h clock, comma as decimal separator, A4 paper, metric system, etc.
% Most settings are either directly copied from en_GB or from i18n
% Special cases are explicitly mentioned
% "en_GB" is part of the GNU C Library and contains locale data.
% The Free Software Foundation does not claim any copyright interest
% in the locale data contained in this file. The foregoing does not
% affect the license of the GNU C Library as a whole. It does not
% exempt you from the conditions of the license if your use would
% otherwise be governed by that license.
LC_IDENTIFICATION
title "INTL English locale for GB (based on en_GB)"
source "Maddes (based on the work of Free Software Foundation, Inc.)"
address "http:////www.github.com//maddes-b//linux-stuff//"
contact ""
email ""
tel ""
fax ""
language "British English"
territory "United Kingdom"
revision "1.0"
date "2024-03-12"
category "i18n:2012";LC_IDENTIFICATION
category "i18n:2012";LC_CTYPE
category "i18n:2012";LC_COLLATE
category "i18n:2012";LC_TIME
category "i18n:2012";LC_NUMERIC
category "i18n:2012";LC_MONETARY
category "i18n:2012";LC_MESSAGES
category "i18n:2012";LC_PAPER
category "i18n:2012";LC_NAME
category "i18n:2012";LC_ADDRESS
category "i18n:2012";LC_TELEPHONE
category "i18n:2012";LC_MEASUREMENT
END LC_IDENTIFICATION
LC_CTYPE
copy "en_GB"
END LC_CTYPE
LC_COLLATE
copy "en_GB"
END LC_COLLATE
LC_MONETARY
% -- taken from en_GB
int_curr_symbol "GBP "
currency_symbol "£"
mon_decimal_point "," % INTL: adapted
mon_thousands_sep "." % INTL: adapted
mon_grouping 3
positive_sign ""
negative_sign "-"
int_frac_digits 2
frac_digits 2
p_cs_precedes 1
p_sep_by_space 0
n_cs_precedes 1
n_sep_by_space 0
p_sign_posn 1
n_sign_posn 1
END LC_MONETARY
LC_NUMERIC
% -- taken from en_GB
decimal_point "," % INTL: adapted
thousands_sep "." % INTL: adapted
grouping 3
END LC_NUMERIC
LC_TIME
copy "en_US@INTL"
END LC_TIME
LC_MESSAGES
copy "en_GB"
END LC_MESSAGES
LC_PAPER
copy "i18n"
END LC_PAPER
LC_NAME
copy "en_GB"
END LC_NAME
LC_ADDRESS
copy "en_GB"
END LC_ADDRESS
LC_TELEPHONE
copy "en_GB"
END LC_TELEPHONE
LC_MEASUREMENT
copy "i18n"
END LC_MEASUREMENT
en_GB.UTF-8@INTL UTF-8
en_US.UTF-8@INTL UTF-8
Reply to: