Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.devel > #112347

Re: Mandatory LC_ALL=C.UTF-8 during package building

From Guillem Jover <guillem@debian.org>
Newsgroups linux.debian.devel
Subject Re: Mandatory LC_ALL=C.UTF-8 during package building
Date 2024-07-02 14:40 +0200
Message-ID <IVKXE-79Nq-9@gated-at.bofh.it> (permalink)
References (4 earlier) <IMH2V-1g0I-7@gated-at.bofh.it> <IMHYZ-1gAe-5@gated-at.bofh.it> <IMI8F-1gDI-5@gated-at.bofh.it> <IVAOB-73mQ-1@gated-at.bofh.it> <IVHwJ-77yn-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi!

On Tue, 2024-07-02 at 09:52:05 +0100, Simon McVittie wrote:
> On Tue, 02 Jul 2024 at 03:47:29 +0200, Guillem Jover wrote:
> > On Fri, 2024-06-07 at 15:40:07 +0200, Alexandre Detiste wrote:
> > > Maybe a compromise would be to at least mandate some UTF-8 locale.
> >
> > dpkg-buildpackage: Require an UTF-8 (or ASCII) locale when
> > building packages
> 
> Allowing ASCII seems counterproductive: that puts us in the code path
> where various tools and runtimes (especially Python) will refuse to
> process or output anything outside the 0-127 range, which I believe is
> exactly the problem that debhelper aims to solve by using C.UTF-8 for
> some categories of package (in particular those that build with Meson).
> 
> To get what Alexandre suggested, we'd need to allow UTF-8 but not allow
> ASCII (so for example fr_FR.UTF-8 or C.UTF-8 is fine, but in particular
> the C locale is not).

Err, you are right. I think I implemented this from my recollection of
the thread, trying to enforce as little as possible, and to try to let
users set "translations" to pure ASCII if desired, but that then defeats
the point brought up in the original mail, and the locale setting in
debhelper. I'll amend the PoC commit to only allow UTF-8.

(Also as long as LC_CTYPE is UTF-8 I think it should not matter whether
LC_MESSAGES is non-UTF-8 as the output codeset should still be UTF-8.)

> Or perhaps this pseudocode?
> 
> if (charset != UTF-8) {
>     emit a warning
>     export LC_ALL=C.UTF-8
>     unset LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE (etc.)
> }

As it stands, I don't think this would be good enough, because it would
introduce an implicit setting in dpkg-buildpackage while it is
currently not the only supported entry point, so packages could still
not rely on this being always set, and it still disables translated
messages.

While erroring out (even when dpkg-buildpackage is still not the only
supported entry point) would not give a full guarantee that a package
build is always done in a UTF-8 locale, it at least forces the caller
(be that a tool or a human) to change the running environment, while
not forcing untranslated messages. I guess this could be made a stronger
guarantee if debhelper switched from unconditionally setting the locale
to performing a similar check and erroring out too (instead of simply
removing the locale setting).


But from your pseudocode, now I realize the check I implemented is
probably too naive, as it should probably at least also check whether
LC_COLLATE is also UTF-8. So I'll try to think how to make it more
robust.

But, I guess I can at least unconditionally set LC_CTYPE=C.UTF-8 when
using --sanitive-env, right away though.

Thanks,
Guillem

Back to linux.debian.devel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Mandatory LC_ALL=C.UTF-8 during package building Gioele Barabucci <gioele@svario.it> - 2024-06-06 08:20 +0200
  Re: Mandatory LC_ALL=C.UTF-8 during package building Luca Boccassi <bluca@debian.org> - 2024-06-06 11:20 +0200
  Re: Mandatory LC_ALL=C.UTF-8 during package building Simon Richter <sjr@debian.org> - 2024-06-06 11:50 +0200
    Re: Mandatory LC_ALL=C.UTF-8 during package building Johannes Schauer Marin Rodrigues <josch@debian.org> - 2024-06-06 12:10 +0200
      Re: Mandatory LC_ALL=C.UTF-8 during package building Johannes Schauer Marin Rodrigues <josch@debian.org> - 2024-06-06 13:00 +0200
        Re: Mandatory LC_ALL=C.UTF-8 during package building Simon Richter <sjr@debian.org> - 2024-06-06 13:40 +0200
        Re: Mandatory LC_ALL=C.UTF-8 during package building Simon McVittie <smcv@debian.org> - 2024-06-06 17:00 +0200
      Re: Mandatory LC_ALL=C.UTF-8 during package building Simon McVittie <smcv@debian.org> - 2024-06-06 16:40 +0200
        Re: Mandatory LC_ALL=C.UTF-8 during package building Jeremy Bícha <jeremy.bicha@canonical.com> - 2024-06-06 16:50 +0200
        Re: Mandatory LC_ALL=C.UTF-8 during package building Guillem Jover <guillem@debian.org> - 2024-06-07 14:40 +0200
          Re: Mandatory LC_ALL=C.UTF-8 during package building Holger Levsen <holger@layer-acht.org> - 2024-06-07 15:40 +0200
            Re: Mandatory LC_ALL=C.UTF-8 during package building Alexandre Detiste <alexandre.detiste@gmail.com> - 2024-06-07 15:50 +0200
              Re: Mandatory LC_ALL=C.UTF-8 during package building Simon McVittie <smcv@debian.org> - 2024-06-07 17:50 +0200
                Re: Mandatory LC_ALL=C.UTF-8 during package building Simon McVittie <smcv@debian.org> - 2024-06-10 17:30 +0200
                Re: Mandatory LC_ALL=C.UTF-8 during package building Simon Richter <sjr@debian.org> - 2024-06-11 11:30 +0200
              Re: Mandatory LC_ALL=C.UTF-8 during package building Guillem Jover <guillem@debian.org> - 2024-07-02 03:50 +0200
                Re: Mandatory LC_ALL=C.UTF-8 during package building Simon McVittie <smcv@debian.org> - 2024-07-02 11:00 +0200
                Re: Mandatory LC_ALL=C.UTF-8 during package building Guillem Jover <guillem@debian.org> - 2024-07-02 14:40 +0200
                Re: Mandatory LC_ALL=C.UTF-8 during package building Alexandre Detiste <alexandre.detiste@gmail.com> - 2024-07-06 13:20 +0200
                Re: Mandatory LC_ALL=C.UTF-8 during package building Guillem Jover <guillem@debian.org> - 2024-08-03 19:20 +0200
                Re: Mandatory LC_ALL=C.UTF-8 during package building Simon McVittie <smcv@debian.org> - 2024-08-03 20:20 +0200
                Re: Mandatory LC_ALL=C.UTF-8 during package building Chris Hofstaedtler <zeha@debian.org> - 2025-02-23 13:50 +0100
          Re: Mandatory LC_ALL=C.UTF-8 during package building Gioele Barabucci <gioele@svario.it> - 2024-06-07 16:20 +0200
          Re: Mandatory LC_ALL=C.UTF-8 during package building Simon McVittie <smcv@debian.org> - 2024-06-07 18:30 +0200
            Re: Mandatory LC_ALL=C.UTF-8 during package building Guillem Jover <guillem@debian.org> - 2024-08-03 15:30 +0200
      Re: Mandatory LC_ALL=C.UTF-8 during package building Marco d'Itri <md@Linux.IT> - 2024-06-06 18:50 +0200
      Re: Mandatory LC_ALL=C.UTF-8 during package building Andrey Rakhmatullin <wrar@debian.org> - 2024-06-06 19:00 +0200
        Re: Mandatory LC_ALL=C.UTF-8 during package building Holger Levsen <holger@layer-acht.org> - 2024-06-07 10:40 +0200
    Locale sanitizer (Was: Mandatory LC_ALL=C.UTF-8 during package  building) Daniel Gröber <dxld@darkboxed.org> - 2024-06-06 14:50 +0200
      Re: Locale sanitizer (Was: Mandatory LC_ALL=C.UTF-8 during package  building) Simon McVittie <smcv@debian.org> - 2024-06-06 15:40 +0200
  Re: Mandatory LC_ALL=C.UTF-8 during package building Adrian Bunk <bunk@debian.org> - 2024-06-18 00:40 +0200

csiph-web