Hi Philip,

Hope this message finds you well.

I had responded to your queries regarding the behavior of the setupcon script 
in my previous update here in the Debian BTS issue. Would like to understand if 
that answers your concerns.
I have attached a revised patch here and have also created a MR in the 
console-setup debian repository[1]. Would like your thoughts on the same.

[1] https://salsa.debian.org/installer-team/console-setup/-/merge_requests/24

Thanks and Regards,
Adithya Balakumar

________________________________
From: balakumar adithya(TSIP DITC_DIT-OST) <adithya.balaku...@toshiba-tsip.com>
Sent: Monday, July 14, 2025 6:43 PM
To: Philip Hands <p...@hands.com>; 977...@bugs.debian.org 
<977...@bugs.debian.org>; an...@lml.bas.bg <an...@lml.bas.bg>
Cc: dinesh kumar(TSIP DITC_DIT-OST) <dinesh.ku...@toshiba-tsip.com>; kunijadar 
shivanand(TSIP DITC_DIT-OST) <shivanand.kunija...@toshiba-tsip.com>; hayashi 
kazuhiro(林 和宏 □DITC○CPT) <kazuhiro3.haya...@toshiba.co.jp>; yoshida toshiko(吉田 
敏子 □DITC○OSPO) <toshiko.yosh...@toshiba.co.jp>
Subject: Re: Bug#977877: console-setup: setupcon --setup-dir ... generates 
temporary file name inside etc/console-setup directory

Hi Philip,

>So far I've failed to persuade this code to leave a mktemp generated
>name in /etc (or elsewhere), so I'm obviously not running it in the
>correct context. Please explain the circumstances under which this bug
>can be reproduced.

The answer to this lies here[1]. If the `if` condition is run, the 
`cached_*.kmap.gz` file is used from `etc/console-setup`. If the `else` 
condition is run, a temp file is created `tmpkbd.*` is created.

The control variable (`KMAP`) for the above mentioned `if` condition comes from 
here[2]. `KMAP` is set to the value of `cached` which is set here[3].

Its essentially down to the existence of this `cached` file in 
`/etc/console-setup` which is controlling the creation of the temp file 
(`tmpkbd.*`) in question.

>Even so, I'm dubious about the way this is being fixed, because it seems
>to me that a randomly named file seems unlikely to be used by anything
>for its configuration, so I'm left wondering why it's being saved at all.

This temporary file is being referenced in a script named `setupcon`(which is 
generated here[4]) under the `/bin` directory within the "setup-dir" specified. 
The name of the temporary file would be updated in the `/bin/setupcon` script 
for everyrun.

>Have we actually established why the file is being saved?

Based on the intended use [5] of the "--setup-dir" option in setupcon, my 
understanding is that the option is meant to used for initrd where the loading 
of the config file (tmpkbd.* or cached_*.kmap) happens via scripts in the 
initrd stage. Hence the need to store the configs in a file (like tmpkbd.* etc)

Apologies for the long answer. Hope this clarifies your initial queries.

Having said this, the most recent patch I shared does not handle the case where 
a `cached_*.kmap.gz` file is saved in the setup directory. Please find a 
revised patch to handle this case as well.

[1] 
https://salsa.debian.org/installer-team/console-setup/-/blob/master/setupcon?ref_type=heads#L1179
[2] 
https://salsa.debian.org/installer-team/console-setup/-/blob/master/setupcon?ref_type=heads#L1172
[3] 
https://salsa.debian.org/installer-team/console-setup/-/blob/master/setupcon?ref_type=heads#L882
[4] 
https://salsa.debian.org/installer-team/console-setup/-/blob/master/setupcon?ref_type=heads#L1286
[5] 
https://manpages.debian.org/testing/console-setup/setupcon.1.en.html#setup-dir

Thanks and Regards,
Adithya Balakumar

Attachment: 0001-setupcon-Copy-temp-files-into-etc-console-setup-with.patch
Description: 0001-setupcon-Copy-temp-files-into-etc-console-setup-with.patch

Reply via email to