[elbe-devel] [PATCH 49/75] hdimg: Fix Pylint
Olivier Dion
dion at linutronix.de
Wed Jun 3 21:50:23 CEST 2020
On Fri, 29 May 2020, Torben Hohn <torben.hohn at linutronix.de> wrote:
> On Mon, May 25, 2020 at 11:42:42AM -0400, Olivier Dion wrote:
>> @@ -261,18 +265,23 @@ class grubinstaller97(grubinstaller_base):
>>
>> chroot(imagemnt, "update-initramfs -u -k all")
>>
>> - # Replace groot and kopt because
>> - # else they will be given bad values
>> - do('chroot %s sed -in "s/^# groot=.*$/# groot=\(hd0,%d\)/" %s' %
>> + # Replace groot and kopt because else they will be given
>> + # bad values
>> + #
>> + # FIXME - Pylint says: Using possibly undefined loop variable
>> + # 'entry' (undefined-loop-variable). entry is defined in
>> + # the previous for-loop.
>> + # # pylint: disable=undefined-loop-variable
>> + do(r'chroot %s sed -in "s/^# groot=.*$/# groot=\(hd0,%d\)/" %s' %
>> (imagemnt, int(entry.partnum) - 1, "/boot/grub/menu.lst"))
>> - do('chroot %s sed -in "s/^# kopt=.*$/# kopt=root=LABEL=%s/" %s' %
>> + do(r'chroot %s sed -in "s/^# kopt=.*$/# kopt=root=LABEL=%s/" %s' %
>> (imagemnt, entry.label, "/boot/grub/menu.lst"))
>
> oh man, this code is pretty broken.
> It will break, when more than one HD image is used.
Would indenting the body up to 'chroot(imagemnt, "update-grub")' in the
loop fixes that?
>
> using entry is also just working out of luck.
> entry will simply point the the deepest filesystem.
> which is /boot in most cases.
--
Olivier Dion
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
More information about the elbe-devel
mailing list