> Personally, I believe it to be a really bad idea to duplicate the > runlevel information in several locations, and would have instead > choosen to simply state that systems without utmp(x) suppport are broken > and need to get utmp support before they will work properly with > sysvinit. utmpx is part of POSIX.
utmpx may be part of POSIX, but that doesn't mean it is supported everywhere. Refusing to implement a work around for systems without utmp just leaves us in a stalemate where musl c won't implement utmp because of the various issues with the standard. And, on the other side, us not providing a workaround, leaving halt/reboot broken on those systems. In that scenario nobody wins. Providing a work around was fairly simple and, so far as I can tell, has no negative side-effect. What is your reasoning for believing providing the work around is a "really bad idea"? What drawback do you see from having it? > How do you handle systems where /var/run/utmp and /var/run/runlevel > differ? Who to believe? If both exist, then init assumes utmp is correct. The /var/run/runlevel file is only used as a fallback if utmp doesn't exist or is corrupted. > Btw, isn't /run/ the proposed location these days? Why /var/run/? > The /run directory doesn't exist on a lot of classic/legacy/UNIX systems. In fact, I don't think it's used anywhere outside of modern, mainstream Linux distros. This patch was intended to improve cross-platform support. Relying on /run would have been a case of one step forward, one step back.