Bug#1028296: dpkg-query man page: unclear about -S reproducibility

2023-01-10 Thread Guillem Jover
Hi!

On Mon, 2023-01-09 at 11:59:17 +0100, Jakub Wilk wrote:
> Package: dpkg
> Version: 1.21.17

> The dpkg-query(1) man page says about the -S option:
> 
> > Hint: When machine parsing the output, it is customary to set the locale
> > to C.UTF-8 to get reproducible results.
> 
> Assuming that "set the locale" means setting the LC_ALL environment
> variable, then that's not sufficient, because the output is still affected
> by LANGUAGE:

I worded that hint vaguely so that I would not need to give details
about system specific quirks. :) In my mind "set the locale" implies
do whatever is necessary so set any locale stuff so that it does not
affect the output. Do you think it would have been more clear to say
instead something like "set the locale and language to C.UTF-8" or
similar?

>$ LC_ALL=C.UTF-8 dpkg -S /bin/zgrep
>diversion by zutils from: /bin/zgrep
>diversion by zutils to: /bin/zgrep.gzip
>gzip, zutils: /bin/zgrep
> 
>$ LANGUAGE=pl LC_ALL=C.UTF-8 dpkg -S /bin/zgrep
>ominięcie przez zutils z: /bin/zgrep
>ominięcie przez zutils do: /bin/zgrep.gzip
>gzip, zutils: /bin/zgrep
> 
> See also bug #748215.

(While I think I might have been aware of the precedence at some point
in time, that might not have properly sink in, as I see several
instances in the code setting LC_ALL but not LANGUAGE (in some cases
LANG instead which perhaps were a typo for LANGUAGE), so I'll be
fixing this in the code in the future. Thanks for the pointer!)

Thanks,
Guillem



Bug#1028296: dpkg-query man page: unclear about -S reproducibility

2023-01-09 Thread Jakub Wilk

Package: dpkg
Version: 1.21.17

The dpkg-query(1) man page says about the -S option:

Hint: When machine parsing the output, it is customary to set the 
locale to C.UTF-8 to get reproducible results.


Assuming that "set the locale" means setting the LC_ALL environment 
variable, then that's not sufficient, because the output is still 
affected by LANGUAGE:


   $ LC_ALL=C.UTF-8 dpkg -S /bin/zgrep
   diversion by zutils from: /bin/zgrep
   diversion by zutils to: /bin/zgrep.gzip
   gzip, zutils: /bin/zgrep

   $ LANGUAGE=pl LC_ALL=C.UTF-8 dpkg -S /bin/zgrep
   ominięcie przez zutils z: /bin/zgrep
   ominięcie przez zutils do: /bin/zgrep.gzip
   gzip, zutils: /bin/zgrep

See also bug #748215.

--
Jakub Wilk