]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/ukify/ukify.py
ukify: don't panic when prepending to an undefined list
authorFrantisek Sumsal <frantisek@sumsal.cz>
Sat, 5 Aug 2023 14:35:09 +0000 (16:35 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Sat, 5 Aug 2023 21:38:46 +0000 (22:38 +0100)
commit0be1de7ffc4a608482e45890425b6fd90f6073f0
tree625ad806a38160c0c4dcf0b8d677dbabbcf85e32
parent804c6397bc39a95968366c031082e96e94ef218c
ukify: don't panic when prepending to an undefined list

Handle the case when all the arguments are passed in through a
configuration file:

$ cat ukify.conf
[UKI]
Linux = /boot/vmlinuz-linux
Initrd = /boot/initramfs-linux.img

Before:
$ src/ukify/ukify.py --config ukify.conf build
Traceback (most recent call last):
  File "/root/systemd/src/ukify/ukify.py", line 1604, in <module>
    main()
  File "/root/systemd/src/ukify/ukify.py", line 1590, in main
    opts = parse_args()
           ^^^^^^^^^^^^
  File "/root/systemd/src/ukify/ukify.py", line 1584, in parse_args
    apply_config(opts)
  File "/root/systemd/src/ukify/ukify.py", line 1431, in apply_config
    item.apply_config(namespace, section_name, group, key, value)
  File "/root/systemd/src/ukify/ukify.py", line 1123, in apply_config
    self.config_push(namespace, group, dest, value)
  File "/root/systemd/src/ukify/ukify.py", line 1019, in config_list_prepend
    setattr(namespace, dest, value + old)
                             ~~~~~~^~~~~
TypeError: can only concatenate list (not "NoneType") to list

After:
$ src/ukify/ukify.py --config ukify.conf build
Kernel version not specified, starting autodetection ðŸ˜–.
Found uname version: 6.4.7-arch1-3
Wrote unsigned vmlinuz-linux.unsigned.efi

Resolves: #28688
src/ukify/ukify.py