[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#903964: locales: buggy regexp in locales.postinst yields useless locales regeneration when locales-all is installed



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


Reply to: