diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2023-08-05 16:35:09 +0200 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2023-08-05 23:38:46 +0200 |
commit | 0be1de7ffc4a608482e45890425b6fd90f6073f0 (patch) | |
tree | 625ad806a38160c0c4dcf0b8d677dbabbcf85e32 /src/ukify/ukify.py | |
parent | man/systemd: avoid duplicate variable name (diff) | |
download | systemd-0be1de7ffc4a608482e45890425b6fd90f6073f0.tar.xz systemd-0be1de7ffc4a608482e45890425b6fd90f6073f0.zip |
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
Diffstat (limited to 'src/ukify/ukify.py')
-rwxr-xr-x | src/ukify/ukify.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py index 8324942f99..cf7db49bdd 100755 --- a/src/ukify/ukify.py +++ b/src/ukify/ukify.py @@ -1016,6 +1016,8 @@ class ConfigItem: assert not group old = getattr(namespace, dest, []) + if old is None: + old = [] setattr(namespace, dest, value + old) @staticmethod |