From nobody@FreeBSD.org  Mon Jan  9 00:09:38 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4BCED1065670
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  9 Jan 2012 00:09:38 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 1CCA98FC17
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  9 Jan 2012 00:09:38 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q0909bAZ056287
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 9 Jan 2012 00:09:37 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q0909bf7056286;
	Mon, 9 Jan 2012 00:09:37 GMT
	(envelope-from nobody)
Message-Id: <201201090009.q0909bf7056286@red.freebsd.org>
Date: Mon, 9 Jan 2012 00:09:37 GMT
From: Devin Teske <dteske@vicor.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH] Fix SVN r228985 regression
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         163938
>Category:       kern
>Synopsis:       [PATCH] Fix SVN r228985 regression
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pluknet
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 09 00:10:11 UTC 2012
>Closed-Date:    Mon Jan 09 20:28:08 UTC 2012
>Last-Modified:  Mon Jan  9 20:30:11 UTC 2012
>Originator:     Devin Teske
>Release:        9.0-RELEASE
>Organization:
FIS Global, Inc.
>Environment:
FreeBSD scribe.vicor.com 9.0-RELEASE FreeSBD 9.0-RELEASE #0: Tue Jan 3 07:46:30 UTC 2012
root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
If booting from the interactive loader(8) prompt when beastie_disable="YES" is set in loader.conf(5), it causes a spurious warning on the console when booting the kernel. This spurious warning has caused some to be concerned, though they need not be. The warning is only shown when executing "boot" from the _interactive_ loader(8) prompt and does not cause any problems (boot continues to succeed).

The attached patch gets rid of this warning for those that (a) set beastie_disable="YES" in loader.conf(5) and (b) commonly drop to the interactive loader(8) prompt to execute "boot" or "boot -s" (for example).
>How-To-Repeat:
First, make sure that SVN rev 228985 (the revision that introduced this spurious warning) is applied to the system. Add beastie_disable="YES" to loader.conf(5). Reboot your system and as your system is booting (after the kernel has been loaded [but not-yet executed]), escape the autoboot 10-second delay by pressing the SPACE bar. Then, at the "ok" prompt, type "boot".

Before the kernel is executed, the warning "menu-unset not found" appears. However, your system will continue to boot.
>Fix:
The attached patch modifies sys/boot/forth/loader.4th to check the beastie_disable variable before attempting to evaluate the "menu-unset" function.

Getting rid of the warning (which is merely a by-product of a failed catch-throw statement only when executing interactively with the loader) will go far to eliminate people's concerns as well as simply clean up the boot to prevent spurious warnings.

Patch attached with submission follows:

--- sys/boot/forth/loader.4th.orig	Thu Dec 29 22:24:59 2011
+++ sys/boot/forth/loader.4th	Sun Jan  8 15:05:46 2012
@@ -44,6 +44,14 @@
 only forth also support-functions also builtins definitions
 
 : try-menu-unset
+  s" beastie_disable" getenv
+  dup -1 <> if
+    s" YES" compare-insensitive 0= if
+      exit
+    then
+  else
+    drop
+  then
   s" menu-unset"
   ['] evaluate catch if
     2drop


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-amd64->pluknet 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Jan 9 00:28:18 UTC 2012 
Responsible-Changed-Why:  
Over to committer of revision in question. 

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

From: Devin Teske <devin.teske@fisglobal.com>
To: <bug-followup@FreeBSD.org>, <dteske@vicor.com>
Cc:  
Subject: Re: kern/163938: [PATCH] Fix SVN r228985 regression
Date: Sun, 8 Jan 2012 17:55:51 -0800

 --Apple-Mail-1--125399519
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain; charset="us-ascii"
 
 Just got Sergey's (pluknet@) response to my initial analysis of this regres=
 sion. I like his solution too, but think that this patch and his solution s=
 hould be merged.
 
 Here's a new patch that combines both changes.
 
 The net-effect is a better one:
 1. If beastie_disable=3D"YES" is added to loader.conf(5), the try-menu-unse=
 t word will not attempt to invoke menu-unset (this seems sane because the m=
 enu will have never been conigured).
 2. The sfind primitive is a safer approach than my original attempt at conj=
 uring a foreign word safely (menu-unset).
 
 See attached patch.txt.
 --=20
 Devin
 
 _____________
 The information contained in this message is proprietary and/or confidentia=
 l. If you are not the intended recipient, please: (i) delete the message an=
 d all copies; (ii) do not disclose, distribute or use the message in any ma=
 nner; and (iii) notify the sender immediately. In addition, please be aware=
  that any message addressed to our domain is subject to archiving and revie=
 w by persons other than the intended recipient. Thank you.
 
 --Apple-Mail-1--125399519
 Content-Disposition: attachment; filename="patch.txt"
 Content-Type: text/plain; x-unix-mode=0664; name="patch.txt"
 Content-Transfer-Encoding: 7bit
 
 --- sys/boot/forth/loader.4th.orig	Thu Dec 29 22:24:59 2011
 +++ sys/boot/forth/loader.4th	Sun Jan  8 17:49:47 2012
 @@ -44,9 +44,19 @@
  only forth also support-functions also builtins definitions
  
  : try-menu-unset
 +  s" beastie_disable" getenv
 +  dup -1 <> if
 +    s" YES" compare-insensitive 0= if
 +      exit
 +    then
 +  else
 +    drop
 +  then
    s" menu-unset"
 -  ['] evaluate catch if
 -    2drop
 +  sfind if
 +    execute
 +  else
 +    drop
    then
  ;
  
 
 --Apple-Mail-1--125399519--
State-Changed-From-To: open->closed 
State-Changed-By: pluknet 
State-Changed-When: Mon Jan 9 20:26:18 UTC 2012 
State-Changed-Why:  
Committed, thanks! I close this PR as this is only issue in head. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/163938: commit references a PR
Date: Mon,  9 Jan 2012 20:25:33 +0000 (UTC)

 Author: pluknet
 Date: Mon Jan  9 20:25:14 2012
 New Revision: 229881
 URL: http://svn.freebsd.org/changeset/base/229881
 
 Log:
   Get rid of a spurious warning on the console when booting the kernel
   from the interactive loader(8) prompt and beastie_disable="YES" is set
   in loader.conf(5). In this case menu.rc is not evaluated and consequently
   menu-unset does not have a body yet. This results in the ficl warning
   "menu-unset not found" when try-menu-unset invokes menu-unset.
   
   Check for beastie_disable="YES" explicitly, so that the try-menu-unset
   word will not attempt to invoke menu-unset because the menu will have
   never been configured. [1]
   Use the sfind primitive as a last resort as an additional safer approach
   conjuring a foreign word safely. [2]
   
   PR:		kern/163938
   Submitted by:	Devin Teske [1]
   Reviewed by:	Devin Teske [2]
   Reported and tested by:	dim
   MFC after:	1 week
   X-MFC with:	r228985
 
 Modified:
   head/sys/boot/forth/loader.4th
 
 Modified: head/sys/boot/forth/loader.4th
 ==============================================================================
 --- head/sys/boot/forth/loader.4th	Mon Jan  9 20:16:06 2012	(r229880)
 +++ head/sys/boot/forth/loader.4th	Mon Jan  9 20:25:14 2012	(r229881)
 @@ -44,9 +44,20 @@ include /boot/support.4th
  only forth also support-functions also builtins definitions
  
  : try-menu-unset
 +  \ menu-unset may not be present
 +  s" beastie_disable" getenv
 +  dup -1 <> if
 +    s" YES" compare-insensitive 0= if
 +      exit
 +    then
 +  else
 +    drop
 +  then
    s" menu-unset"
 -  ['] evaluate catch if
 -    2drop
 +  sfind if
 +    execute
 +  else
 +    drop
    then
  ;
  
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
