Discussion:
Bug#903964: locales: buggy regexp in locales.postinst yields useless locales regeneration when locales-all is installed
(too old to reply)
Vincent Lefevre
2018-07-17 12:10:01 UTC
Permalink
Package: locales
Version: 2.27-5
Severity: normal

When upgrading, I got the following:

[...]
Setting up locales (2.27-5) ...
Generating locales (this might take a while)...
aa_DJ.UTF-8... done
aa_DJ.ISO-8859-1... done
aa_ER.UTF-8... done
[...]
zu_ZA.UTF-8... done
zu_ZA.ISO-8859-1... done
Generation complete.
Setting up libbinutils:amd64 (2.31-1) ...
Setting up keyutils (1.5.9-9.3) ...
Setting up locales-all (2.27-5) ...
[...]

i.e. the locales are regenerated by locales.postinst, but then
/usr/lib/locale/locale-archive is removed by locales-all.postinst,
so that the regeneration of the locales takes time and is useless.

/var/lib/dpkg/info/locales.postinst contains:

# Update requested locales if locales-all is not installed
if dpkg-query -W -f='${db:Status-Abbrev}' locales-all 2>/dev/null | grep -q '^.i' ; then
echo "locales-all installed, skipping locales generation"
else
locale-gen
fi

I think that the '^.i' regexp is incorrect during an upgrade.

According to the dpkg-query(1) man page:

Desired action:
u = Unknown
i = Install
h = Hold
r = Remove
p = Purge

Package status:
n = Not-installed
c = Config-files
H = Half-installed
U = Unpacked
F = Half-configured
W = Triggers-awaiting
t = Triggers-pending
i = Installed

Error flags:
<empty> = (none)
R = Reinst-required

so that it is testing the package status of locales-all. But during
an upgrade, the actual status is "iU " (things may be different if
packages are upgraded separately).

Shouldn't the desired action be tested instead, i.e. '^i'?

-- System Information:
Debian Release: buster/sid
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.16.0-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=POSIX (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages locales depends on:
ii debconf [debconf-2.0] 1.5.67
ii libc-bin 2.27-5
ii libc-l10n 2.27-5

locales recommends no packages.

locales suggests no packages.

-- debconf information:
* locales/locales_to_be_generated: All locales
* locales/default_environment_locale: None
Vincent Lefevre
2018-07-17 13:10:01 UTC
Permalink
Post by Vincent Lefevre
u = Unknown
i = Install
h = Hold
r = Remove
p = Purge
n = Not-installed
c = Config-files
H = Half-installed
U = Unpacked
F = Half-configured
W = Triggers-awaiting
t = Triggers-pending
i = Installed
<empty> = (none)
R = Reinst-required
so that it is testing the package status of locales-all. But during
an upgrade, the actual status is "iU " (things may be different if
packages are upgraded separately).
Shouldn't the desired action be tested instead, i.e. '^i'?
Well, actually this is probably incorrect. It could also be on hold.
And I'm not sure what "Desired action" means exactly. If locales-all
is marked for installation in dselect, will this be "i"? In such a
case, using "Desired action" is not possible; see:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=840901

Perhaps a combination of flags of "Package status"...
'^.[UFWti]'?
--
Vincent Lefèvre <***@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Loading...