From nobody@FreeBSD.org  Sun Aug 15 10:48:14 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 0590516A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 15 Aug 2004 10:48:14 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id EEA5A43D2F
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 15 Aug 2004 10:48:13 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i7FAmDxu083060
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 15 Aug 2004 10:48:13 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.11/8.12.11/Submit) id i7FAmD4g083059;
	Sun, 15 Aug 2004 10:48:13 GMT
	(envelope-from nobody)
Message-Id: <200408151048.i7FAmD4g083059@www.freebsd.org>
Date: Sun, 15 Aug 2004 10:48:13 GMT
From: Dmitri Nikulin <setagllib@optusnet.com.au>
To: freebsd-gnats-submit@FreeBSD.org
Subject: sbin/reboot change, -p behavior default for halt
X-Send-Pr-Version: www-2.3

>Number:         70476
>Category:       bin
>Synopsis:       [patch] reboot(8) change, -p behavior default for halt
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 15 10:50:13 GMT 2004
>Closed-Date:    
>Last-Modified:  Thu Aug 19 19:08:15 UTC 2010
>Originator:     Dmitri Nikulin
>Release:        5.2-CURRENT
>Organization:
>Environment:
>Description:
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).
>How-To-Repeat:
halt without -p
>Fix:
diff -ruN reboot/reboot.8 reboot.new/reboot.8
--- reboot/reboot.8    2004-07-31 22:11:35.000000000 +1000
+++ reboot.new/reboot.8    2004-08-15 22:47:20.349003304 +1000
@@ -112,6 +112,7 @@
or
.Nm
was called.
+(If called as halt, this is the default)
.El
.Pp
The
diff -ruN reboot/reboot.c reboot.new/reboot.c
--- reboot/reboot.c    2004-07-31 22:11:35.000000000 +1000
+++ reboot.new/reboot.c    2004-08-15 22:41:12.656901000 +1000
@@ -72,10 +72,10 @@

    if (strstr((p = rindex(*argv, '/')) ? p + 1 : *argv, "halt")) {
        dohalt = 1;
-        howto = RB_HALT;
+        howto = RB_HALT|RB_POWEROFF;
    } else
        howto = 0;
-    kflag = lflag = nflag = qflag = 0;
+    kflag = lflag = nflag = qflag = pflag = 0;
    while ((ch = getopt(argc, argv, "dk:lnpq")) != -1)
        switch(ch) {
        case 'd': 

(Unbroken copy at http://members.optusnet.com.au/setagllib/reboot.patch)
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->vanilla 
Responsible-Changed-By: vanilla 
Responsible-Changed-When: Sun Aug 15 13:22:24 GMT 2004 
Responsible-Changed-Why:  
I will handle this one. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=70476 
Responsible-Changed-From-To: vanilla->freebsd-bugs 
Responsible-Changed-By: vanilla 
Responsible-Changed-When: Sun Aug 15 13:22:48 GMT 2004 
Responsible-Changed-Why:  
Ops, my fault. I will handle ports/70467, not misc/70476. sorry. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=70476 

From: Giorgos Keramidas <keramida@freebsd.org>
To: Dmitri Nikulin <setagllib@optusnet.com.au>
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;
 %%%
Responsible-Changed-From-To: freebsd-bugs->edwin 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Tue Jan 29 12:42:00 UTC 2008 
Responsible-Changed-Why:  
Might do this with menotr. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=70476 

From: Edwin Groothuis <edwin@freebsd.org>
To: bug-followup@FreeBSD.org, setagllib@optusnet.com.au
Cc:  
Subject: Re: bin/70476: sbin/reboot change, -p behavior default for halt
Date: Tue, 29 Jan 2008 23:42:16 +1100

 Please note that the -p option is already there, it's just poweroff
 command which isn't there (yet).
 
 -- 
 Edwin Groothuis
 edwin@freebsd.org
 http://www.mavetju.org

Responsible-Changed-From-To: edwin->freebsd-bugs 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Thu Feb 14 10:27:36 UTC 2008 
Responsible-Changed-Why:  

Give back into the pool until later. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=70476 
>Unformatted:
