Page MenuHomeFreeBSD

reboot: Don't reboot if the next kernel isn't there
ClosedPublic

Authored by imp on Feb 9 2024, 5:12 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 11, 4:06 PM
Unknown Object (File)
Mon, Oct 28, 12:08 AM
Unknown Object (File)
Mon, Oct 21, 1:18 AM
Unknown Object (File)
Mon, Oct 21, 1:18 AM
Unknown Object (File)
Mon, Oct 21, 1:17 AM
Unknown Object (File)
Mon, Oct 21, 1:17 AM
Unknown Object (File)
Mon, Oct 21, 1:17 AM
Unknown Object (File)
Mon, Oct 21, 1:17 AM
Subscribers

Details

Summary

reboot -k garbage won't boot garbage unless /boot/garbage/kernel is
there. Refuse to reboot if it is missing, though allow -f to force
it for special-use cases.

Sponsored by: Netflix

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 55920
Build 52809: arc lint + arc unit

Event Timeline

imp requested review of this revision.Feb 9 2024, 5:12 AM
imp created this revision.
sbin/reboot/reboot.c
143

Wouldn't it better to use err() there, printing real errno?

150

If this open, or any of the following writes, failed, should we declare a similar failure?
(if yes, this would be a separate change)

imp marked 2 inline comments as done.Feb 9 2024, 4:35 PM
imp added inline comments.
sbin/reboot/reboot.c
143

Indeed. Good catch.

150

See D43803. Good suggestion, but the code got a little verbose... but not too bad and these days being as tiny as possible isn't a huge concern.

sbin/reboot/reboot.c
145

errno would already say 'no such item'. On the other hand, if error would be different like EIO, saying 'does not exist' before it is confusing. Typically we just emit the name of the failing syscall, "stat" in this case.

imp marked 2 inline comments as done.

improve error from stat failure

This revision is now accepted and ready to land.Feb 10 2024, 12:49 AM
This revision now requires review to proceed.Feb 11 2024, 2:26 AM

seems reasonable, couple of minor comments

sbin/reboot/reboot.8
90

comma splice here, semicolon or period instead?

sbin/reboot/reboot.c
147
This revision is now accepted and ready to land.Feb 11 2024, 3:18 AM