From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20030716 Description of problem: Description: I have created accounts so that one can halt or reboot the system without first logging into 'root', by putting these entries in /etc/passwd: shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt reboot:x:0:0:reboot:/sbin:/sbin/reboot The first two are standard in the RH 8.0 distribution; I have added 'reboot'. All three logins have the same password as 'root', thus providing security. However, the 'reboot' login halts the system, rather than rebooting it. To the best of my memory, the 'reboot' login worked as expected in RH 7.2. Diagnosis: /sbin/reboot is a symbolic link to /sbin/halt. The binary determines whether it is supposed to "shut down and halt" or "shut down and reboot" by examining the name under with it was invoked, which is pointed to by argv[0]. However, when the binary is invoked by login(?) via the 'reboot' entry in /etc/passwd shown above, argv[0] has the value "-reboot". The binary does not recognize this as meaning that it was invoked as "reboot", and so performs its default action, "shut down and halt." The logic for these tests is at lines 168 to 181 in sysvinit-2.84/src/halt.c in sysvinit-2.84.tar.gz in SysVinit-2.84-5.src.rpm. The value of argv[0] provided by login was determined by inserting "sleep(60);" at the beginning of main() in halt.c, logging into 'reboot' on another VC, attaching to the sleeping reboot process using GDB, and using the usual GDB commands to determine the value of argv[0] and the action of the logic in halt.c in processing it. Suggested fix: Augment the "Find out who we are" logic in halt.c by adding logic to detect and remove any leading "-" on the program name. A patch to do this is attached. Version-Release number of selected component (if applicable): SysVinit-2.84-5 How reproducible: Always Steps to Reproduce: 1.Add this entry to /etc/passwd: reboot:x:0:0:reboot:/sbin:/sbin/reboot 2.Log in as 'reboot', thus initiating system shutdown. Actual Results: System shuts down and halts. Expected Results: Systen should shut down and then reboot. Additional info: This bug can be worked around by having the "shell" of login 'reboot' be a short shell script invoking /sbin/reboot, rather than having the shell be /sbin/reboot itself.
Created attachment 94331 [details] Patch to halt.c to improve its detection of "what name it was invoked using", and thus select the correct action to take.
Added in 2.86-1.
Package name is now sysvinit in Fedora.