-
Notifications
You must be signed in to change notification settings - Fork 26
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
(RHEL-50672) Harden /bin/kernel-install to avoid failing silently when /etc/machine-id doesn't end with newline #290
(RHEL-50672) Harden /bin/kernel-install to avoid failing silently when /etc/machine-id doesn't end with newline #290
Conversation
Commit validationTracker - RHEL-50672 The following commits meet all requirements
Tracker validationSuccess🟢 Tracker RHEL-50672 has set desired product: Pull Request validationSuccess🟢 CI - All checks have passed Auto MergeSuccess🟢 Pull Request is not marked as draft and it's not blocked by |
Let's do at least a minimal check that the read machine ID is valid. RHEL-only: feature Related: RHEL-50672
If /etc/machine-id doesn't end with a newline (which is wrong, but it can happen), kernel-install fails. That's because `read` returns 1 if it reaches EOF and we're using `set -e`. Let's just ignore that error, as it doesn't matter: we have either read a valid machine ID, in which case we continue, or we haven't, in which case we exit anyway. RHEL-only: feature Resolves: RHEL-50672
c53d2b6
to
48eac39
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.
LGTM
[ "$MACHINE_ID" = "uninitialized" ] && unset MACHINE_ID | ||
if [ "$MACHINE_ID" = "uninitialized" ]; then | ||
unset MACHINE_ID | ||
elif [ {{ '${#MACHINE_ID}' }} -ne 32 ]; then |
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.
Took me a bit to realize why this is needed, those pesky Jinja comments :)
Resolves: RHEL-50672