[elbe-devel] [PATCH 49/75] hdimg: Fix Pylint

Olivier Dion dion at linutronix.de
Fri May 29 15:23:51 CEST 2020


On Fri, 29 May 2020, Torben Hohn <torben.hohn at linutronix.de> wrote:

>>  
>> -            # 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.
>
> using entry is also just working out of luck.
> entry will simply point the the deepest filesystem.
> which is /boot in most cases.

I though so.  The idendation is wrong on the 'do'.

-- 
Olivier Dion
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen



More information about the elbe-devel mailing list