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)
Fri, Apr 26, 4:13 PM
Unknown Object (File)
Fri, Apr 26, 4:12 PM
Unknown Object (File)
Fri, Apr 26, 4:12 PM
Unknown Object (File)
Fri, Apr 26, 4:12 PM
Unknown Object (File)
Fri, Apr 26, 4:12 PM
Unknown Object (File)
Fri, Apr 26, 4:12 PM
Unknown Object (File)
Fri, Apr 26, 10:47 AM
Unknown Object (File)
Sun, Apr 14, 5:38 PM
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 Not Applicable
Unit
Tests Not Applicable

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