Page MenuHomeFreeBSD

reboot: powering off and rebooting at the same time doesn't make sense
Needs RevisionPublic

Authored by rosenfeld_grumpf.hope-2000.org on Sep 6 2024, 10:05 AM.
Tags
None
Referenced Files
F102677854: D46559.diff
Fri, Nov 15, 6:08 PM
Unknown Object (File)
Wed, Nov 6, 4:29 PM
Unknown Object (File)
Wed, Nov 6, 4:29 PM
Unknown Object (File)
Sat, Oct 19, 1:07 AM
Unknown Object (File)
Fri, Oct 18, 11:21 PM
Unknown Object (File)
Oct 16 2024, 11:34 AM
Unknown Object (File)
Oct 14 2024, 5:53 PM
Unknown Object (File)
Oct 14 2024, 10:56 AM
Subscribers

Details

Reviewers
imp

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 59335
Build 56222: arc lint + arc unit

Event Timeline

imp requested changes to this revision.Sep 6 2024, 4:13 PM

NAK.

This is a bad change and should be rejected outright.

It breaks 'halt -p' since that's a hard link to reboot.

This revision now requires changes to proceed.Sep 6 2024, 4:13 PM

Hmmm, OK, it doesn't break halt -p. I misread a couple of things...
This is likely OK, but may surprise some people who just know reboot -p.

However, the -cp makes sense as does -ch or -cr, and they mean different things. reboot -cp means 'powercycle, if you can, otherwise power off' and -ch means 'powercycle if you can otherwise halt' and -cr means power cycle if you can, otherwise just reboot.

So while -ph doesn't seem to make sense, it is poweroff-or-halt. and -pr is 'poweroff-or-reboot'. Because the hardware is weird, you want the ability to have a fallback.

About the only thing that doesn't make sense -hr which wants you to both halt and reboot. If the reboot fails for some reason, it will de-facto halt since that hits a while (1); loop.

"-cp" is already illegal, see the check on line 303 and 304, so nothing changes in that regard. Also, "-r cannot be used with -c, -d, -n, or -p" already. I also see no "-h" option, so no "-ch" either, or am I missing anything here?

That being said, I've been bitten by this a few times. I've created this review last Friday because I accidentally powered down a system in a remote location that I can't remotely power on. When I type "reboot" with whatever arguments, I really want the system to reboot. That is to say that I really expect it to come back up shortly, not to halt or power off. While I can see that it's possible that there are people that habitually use "reboot -p" to power off a system, I really wonder why since "halt -p" is shorter to type and "poweroff" is clearer. But of course YMMV.