/usr/bin/cargo2rpm --path Cargo.toml buildrequires
Traceback (most recent call last):
File "/usr/bin/cargo2rpm", line 8, in <module>
sys.exit(main())
^^^^^^
File "/usr/lib/python3.11/site-packages/cargo2rpm/main.py", line 99, in main
action_buildrequires(args)
File "/usr/lib/python3.11/site-packages/cargo2rpm/main.py", line 50, in action_buildrequires
brs = workspace_buildrequires(metadata, flags, args.with_check)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/cargo2rpm/rpm.py", line 221, in workspace_buildrequires
member_flags = metadata.get_feature_flags_for_workspace_members(flags)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/cargo2rpm/metadata.py", line 642, in get_feature_flags_for_workspace_members
if member_defaults[package.name] and "default" in package.get_feature_names(): ~~~^^^^^^^^^^^^^^
KeyError: 'backingstore'
I don't know how special the case is that triggers this problem, but no
amount of garbage input should be able to make the tool crash. It
seems like a case that could be handled.
This could be resolved by never using indexing when looking up in
member_defaults, but always use .get() . There would thus not be any
need for initializing it to False, neither with nor without
flags.no_default_features . But it seems like it would be
more close to the intention to unconditionally initialize it to False
for all packages.
This change fixes the crash, but I am not sure it tool does the right
thing, or if the crash indicates a TODO situation.
Fooling around with packaging sapling, I got:
Traceback (most recent call last):
File "/usr/bin/cargo2rpm", line 8, in <module>
sys.exit(main())
^^^^^^
File "/usr/lib/python3.11/site-packages/cargo2rpm/main.py", line 99, in main
action_buildrequires(args)
File "/usr/lib/python3.11/site-packages/cargo2rpm/main.py", line 50, in action_buildrequires
brs = workspace_buildrequires(metadata, flags, args.with_check)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/cargo2rpm/rpm.py", line 221, in workspace_buildrequires
member_flags = metadata.get_feature_flags_for_workspace_members(flags)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/cargo2rpm/metadata.py", line 642, in get_feature_flags_for_workspace_members
if member_defaults[package.name] and "default" in package.get_feature_names():
~~~^^^^^^^^^^^^^^KeyError: 'backingstore'
I don't know how special the case is that triggers this problem, but no
amount of garbage input should be able to make the tool crash. It
seems like a case that could be handled.
This could be resolved by never using indexing when looking up in
member_defaults, but always use .get() . There would thus not be any
need for initializing it to False, neither with nor without
flags.no_default_features . But it seems like it would be
more close to the intention to unconditionally initialize it to False
for all packages.
This change fixes the crash, but I am not sure it tool does the right
thing, or if the crash indicates a TODO situation.