Fix incorrect condition in initramfs_tool_helper() path argument handling#35
Open
dkeven wants to merge 1 commit intoNVIDIA:mainfrom
Open
Fix incorrect condition in initramfs_tool_helper() path argument handling#35dkeven wants to merge 1 commit intoNVIDIA:mainfrom
dkeven wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix a logic error in
initramfs_tool_helper()where the path argument handling used a singleif/elsewith a combined outer conditionif (path && path_specific_args), causing two distinct issues:When the tool is
update-initramfs(path_specific_args = NULL,requires_path = FALSE) and an initramfs image such as/boot/initrd.img-<kernel>exists, the first attempt always falls through to theelsebranch where!pathevaluates to true (sincepathisNULLon the first call), producing a misleading warning:"/usr/sbin/update-initramfs requires a file path argument, but none was given."The command only actually runs on the second attempt.
When executed on a machine where
/bootcontains onlyinitrd.imgwithout a kernel-versioned suffix,get_initramfs_path()returnsNULLfor all attempts. Since theelsebranch conditionrequires_path || !pathis always true whenpathisNULL, all 4 retry attempts emit the same warning andupdate-initramfsis never executed, resulting in:"Failed to rebuild the initramfs!".This also removes a dead code path where
!path_specific_argswas checked inside a block that already requiredpath_specific_argsto be non-NULL.I've built nvidia-installer and tested this fix myself, and
update-initramfs -uexecutes successfully on the firstattempt in both scenarios described above.