From owner-freebsd-bugs@FreeBSD.ORG Mon Aug 16 12:30:31 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 48A0216A4CE for ; Mon, 16 Aug 2004 12:30:31 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 21D8C43D5A for ; Mon, 16 Aug 2004 12:30:31 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i7GCUVou033851 for ; Mon, 16 Aug 2004 12:30:31 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i7GCUUBo033848; Mon, 16 Aug 2004 12:30:30 GMT (envelope-from gnats) Date: Mon, 16 Aug 2004 12:30:30 GMT Message-Id: <200408161230.i7GCUUBo033848@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Giorgos Keramidas Subject: Re: misc/70476: sbin/reboot change, -p behavior default for halt X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Giorgos Keramidas List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2004 12:30:31 -0000 The following reply was made to PR misc/70476; it has been noted by GNATS. From: Giorgos Keramidas To: Dmitri Nikulin Cc: bug-followup@freebsd.org Subject: Re: misc/70476: sbin/reboot change, -p behavior default for halt Date: Mon, 16 Aug 2004 15:22:09 +0300 (EEST) On 2004-08-15 12:58, Dmitri Nikulin wrote: > Power-off functionality is usually expected from systems which support ACPI > even half as well as FreeBSD does, yet the default behavior of halt is a > completely soft shutdown. Environments that use halt (e.g. display managers) > need messy reconfiguration, and users that aren't aware of the -p flag might > never learn about it. Using acpiconf properly achieves the same result but > with even more divergence from what people expect to have to type. > > Applied from src/sbin, this patch makes -p functionality the default for halt > (much like on typical GNU/Linux systems). On Debian GNU/Linux this is not the default behavior. The halt command is equivalent to a power off only when called as "poweroff". The manpage of halt includes: -p When halting the system, do a poweroff. This is the default when halt is called as poweroff. It might also be worth noting that the patch you attached removes the ability to "halt" without powering off completely. If you do change the behavior of halt, then please do it by introducing a new hard-link of reboot called "poweroff". Then the -p option would be easy to set by default for "poweroff" without changing the current behavior of "halt". What do you think of using the following patch instead? %%% Index: Makefile =================================================================== RCS file: /home/ncvs/src/sbin/reboot/Makefile,v retrieving revision 1.13 diff -u -r1.13 Makefile --- Makefile 22 Mar 2004 00:52:27 -0000 1.13 +++ Makefile 16 Aug 2004 12:13:04 -0000 @@ -15,7 +15,8 @@ .endif LINKS= ${BINDIR}/reboot ${BINDIR}/halt ${BINDIR}/reboot ${BINDIR}/fastboot \ - ${BINDIR}/reboot ${BINDIR}/fasthalt + ${BINDIR}/reboot ${BINDIR}/fasthalt \ + ${BINDIR}/reboot ${BINDIR}/poweroff SCRIPTS= nextboot.sh Index: reboot.c =================================================================== RCS file: /home/ncvs/src/sbin/reboot/reboot.c,v retrieving revision 1.20 diff -u -r1.20 reboot.c --- reboot.c 9 Apr 2004 19:58:35 -0000 1.20 +++ reboot.c 16 Aug 2004 12:18:27 -0000 @@ -70,9 +70,13 @@ char *kernel, *p; const char *user; - if (strstr((p = rindex(*argv, '/')) ? p + 1 : *argv, "halt")) { + p = rindex(argv[0], '/') ? p + 1 : argv[0]; + if (strcmp(p, "halt") == 0) { dohalt = 1; howto = RB_HALT; + } else if (strcmp(p, "poweroff") == 0) { + dohalt = 1; + howto = RB_POWEROFF; } else howto = 0; kflag = lflag = nflag = qflag = 0; %%%