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

Bug#1011254: The UDEB package "localechooser" contains probably some buggy source code in "05localechooser" file



Jmkr <jmkrnet@email.cz> writes:

> Package: localechooser
> Version: 2.94
>
> Dear Maintainers,
>
> While working on my customized Debian installer (DI) I noticed that the 
> "./usr/lib/post-base-installer.d/05localechooser" file from the 
> "localechooser_2.93_*.udeb" package (at least for AMD64 and ARM64 
> architectures) contains probably buggy source code for calculating the 
> value of the "LEVEL" variable (on lines 87-91). The problems are in 
> "cut" commands (on lines 88 and 91) which should probably be:
> cut -f 1-3 -d \;
> cut -f 2 -d \;
>
> Currently the "LEVEL" variable seems to get the empty string value 
> because the "grep" command (on line 89) cannot find the language code 
> (because the first field is removed by the first "cut" command). Maybe 
> the "LANGUAGECODE" variable on line 83 could be avoided and merged into 
> the "LEVEL" variable if command substitution is done using "$(...)" 
> resulting in this proposed source code:
> LEVEL=$(cat /usr/share/localechooser/languagelist | \
>              cut -f 1-3 -d \; | \
>              grep $(echo $LOCALE | cut -f 1 -d _) | \
>              head -n 1 | \
>              cut -f 2 -d \;)

Yes, we were cutting off the LANGUAGECODE column before trying to grep
it, so the old code would never come up with a level of 3 or 4.

BTW I would suggest using:

  ${LOCALE%%_*} in place of the $(echo ... | cut ...)

Actually, I'm unable to resist the urge to remove the redundant use of
cat (that was already there), so how about doing it in a single sed:

  LEVEL=$(sed "/^${LOCALE%%_*}/"'{ print $4 ; exit }' /usr/share/localechooser/languagelist)

I've put that into this branch (with a few of other tweaks):

  https://salsa.debian.org/philh/localechooser/-/commits/bug1011254

and here is a mini-iso that includes that change:

  https://salsa.debian.org/installer-team/debian-installer/-/jobs/2785179/artifacts/file/public/gtk-mini.iso

[note that it's built by infrastructure that's not under our direct
control, so such images should be viewed with a degree of suspicion]

If you'd like to test that, please do, otherwise perhaps you can suggest
a test that would determine that the code is behaving as you'd hope.

Cheers, Phil.
-- 
|)|  Philip Hands  [+44 (0)20 8530 9560]  HANDS.COM Ltd.
|-|  http://www.hands.com/    http://ftp.uk.debian.org/
|(|  Hugo-Klemm-Strasse 34,   21075 Hamburg,    GERMANY

Attachment: signature.asc
Description: PGP signature


Reply to: