Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virtme: fix traceback with --kdir when .config doesn't exist #73

Merged
merged 1 commit into from
Feb 17, 2024

Conversation

WOnder93
Copy link
Contributor

Reproducer:

$ mkdir -p testdir/arch/x86/boot
$ touch testdir/arch/x86/boot/bzImage
$ virtme-run --kdir testdir
Traceback (most recent call last):
  File "/usr/bin/virtme-run", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.12/site-packages/virtme/commands/run.py", line 1388, in main
    return do_it()
           ^^^^^^^
  File "/usr/lib/python3.12/site-packages/virtme/commands/run.py", line 803, in do_it
    kernel = find_kernel_and_mods(arch, args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/virtme/commands/run.py", line 486, in find_kernel_and_mods
    kernel.config is not None
    ^^^^^^^^^^^^^
AttributeError: 'Kernel' object has no attribute 'config'

Fix the above by initializing kernel.config right away.

Reproducer:
```
$ mkdir -p testdir/arch/x86/boot
$ touch testdir/arch/x86/boot/bzImage
$ virtme-run --kdir testdir
Traceback (most recent call last):
  File "/usr/bin/virtme-run", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.12/site-packages/virtme/commands/run.py", line 1388, in main
    return do_it()
           ^^^^^^^
  File "/usr/lib/python3.12/site-packages/virtme/commands/run.py", line 803, in do_it
    kernel = find_kernel_and_mods(arch, args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/virtme/commands/run.py", line 486, in find_kernel_and_mods
    kernel.config is not None
    ^^^^^^^^^^^^^
AttributeError: 'Kernel' object has no attribute 'config'
```

Fix the above by initializing kernel.config right away.

Signed-off-by: Ondrej Mosnáček <[email protected]>
@arighi arighi merged commit 3d347e6 into arighi:main Feb 17, 2024
4 checks passed
@WOnder93 WOnder93 deleted the fix-traceback-config branch February 17, 2024 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants