-
Notifications
You must be signed in to change notification settings - Fork 165
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
Allow dkms to work in a chroot environment without /proc #485
Conversation
@akorn I'm all for the change, but the tests are failing, can you have a look? Thanks. If the change requires changes to the tests, please provide those as well. |
@scaronni, with my latest commit the tests mostly succeed, except this one:
It seems that where the test expects Is that really a problem? If yes, I don't know how to fix it (i.e. break it again); I couldn't immediately understand how the tests even work. |
@anbe42, you wrote that noisy test that now succeeds instead of failing. Can you help a bit here? Why/how is |
Do you have the same kernel running on the host and installed in the chroot? Try a different kernel in the chroot. Usually host and chroot have different kernels (as it happens in all the CI scenarios) and the wrong 'make clean' command picks the wrong kernel (the one from the host). IIRC I had some checks for this issue, but maybe not in this specific test case. |
If I only have a different kernel in the chroot, the tests fail much sooner:
If I have both the same and a newer kernel, the testsuite fails later:
And if I have an older, the same, and a newer kernel:
It doesn't seem like I can satisfy this particular test. @anbe42, any suggestions? |
@scaronni meanwhile, can you perhaps rerun the tests in the official test environment? Who knows, they might succeed there. :) Thanks! |
The applied substitution does not produce identical results if it involves empty command output:
This breaks e.g. 'autoinstall'
Please rebase your branch on master. |
@akorn i've also fixed the issues with the fedora rawhide containers, so if you rebase on master at least you would get working tests. |
I know. I was hunting for occurrences where this mattered and already resolved some of them in commits 6801dc1 and 5f9f3c0, but not all (not being able to run the tests myself doesn't help -- I guess I'll just disable the noisy one locally).
I'll deal with this soon.
Done. |
@scaronni, can you rerun the tests? They succeed for me now (except the noisy one, but I don't think that's related to my changes). |
Running, sorry for the delay. |
it now works for me in my Debian test setup I'll try to test without /proc, too @scaronni: is it possible to add one test (any distribution, prefereably one utilizing the weak module code paths) with /proc unmounted to the CI matrix? @akorn: please rebase ( |
I think we can just add an extra tag in the table here: https://github.com/dell/dkms/blob/master/.github/workflows/tests.yml#L15 And then trigger a specific task in the tests than unmouns
Yes please, do a clean rebase (Fast Forward merge), no merge commits please. Besides this, I think it's fine for merging once corrected. Thanks. |
26afe79
to
57e045b
Compare
@anbe42 I'm fine with merging as soon as the tests pass. Do you agree? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In bash we can use [[ $var ]]
to check for non-empty values. While it is not being used consistently, [[ -n "$var" ]]
is less common (8 vs. 13 occurrences). So I'd prefer the shorter form.
Should I make this change everywhere for consistency, or just in the new lines that I'm adding? |
only in your new bits in order not to interfere with the ongoing shellcheck changes (#492) |
Done, I think. |
I finally managed to reproduce that and I'm currently testing a fix ... |
need to try that again, my machine crashed last night ... hopefully unrelated to that test ;-) |
11af52a
to
16e4d5a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can squash most of your fixup commits together. The /proc/cpuinfo check should stay separate. If I'm not mistaken, everything else deals with skipping the empty lines introduced by using the alternate idiom.
Please wait with rebasing for #492 (the shellcheck changes) being merged, that may cause some conflicts and may require some further reworking.
I've just tried adding a umount /proc && run_tests.sh
test to the Debian package and tested your branch with it. Didn't explode ;-)
Yes, I think so too.
Roger that, standing by.
That's good news -- I think I fixed almost all bugs that could have led to actual explosions. :) |
16e4d5a
to
aa27325
Compare
aa27325
to
6e488b5
Compare
6e488b5
to
1265f10
Compare
OK, after, ah, gaining some new experience with git I believe this is now done. NB. when I first ran the tests locally, there was a cosmetic difference in |
New shell check errors:
|
@scaronni, can you merge this, or should I squash the last commit (fix shellcheck warnings) into the previous one (avoid running loops on empty strings)? |
For me is fine as is. @anbe42 ? |
@scaronni: I've tried adding tests doing See the top commit of |
@akorn: I've slightly reorganized your branch and fixed a few whitespace errors while doing that: https://github.com/anbe42/dkms/commits/chroot-no-proc2 I would have liked to add some tests starting with |
@anbe42 to be honest I don't know, I don't think we can avoid proc being mounted... so I would merge as is. |
The shift from the `< <(cmd)` idom to `<<<"$(cmd)"` which is needed to work without /proc being mounted has the unfortunate side effect that the exit status of `cmd` is ignored where it wasn't before. This can cause statements that previously always had valid input to be called on empty strings. This commit adds sanity checks to avoid processing the empty string where previously variables always contained something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for your work!
@@ -827,6 +827,7 @@ get_module_verinfo(){ | |||
vals= | |||
while read -ra vals; do | |||
[[ ${#vals[@]} -eq 0 ]] && continue | |||
[[ ${vals[0]} ]] || continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have replaced that with a check for a non-empty array, not a non-empty first element.
Merged with some white-space errors fixed. |
|
I didn't author these changes; I'm just submitting the pull request (with the author's permission) in the hope that it can be merged with little or no discussion.
It's a fairly small and self-explanatory set of changes that, at least at first glance, shouldn't alter existing behaviour, just make dkms as a whole more robust by not requiring
/proc
to be mounted for it to work.