docs/108101: /boot/default/loader.conf contains an incorrect comment

Wayne Sierke ws at au.dyndns.ws
Wed Sep 8 17:57:53 UTC 2010


On Tue, 2010-09-07 at 17:17 -0400, John Baldwin wrote:
> On Tuesday, September 07, 2010 4:40:55 pm Brad Davis wrote:
> > On Tue, Sep 07, 2010 at 02:54:27PM -0400, John Baldwin wrote:
> > > On Tuesday, September 07, 2010 12:52:25 pm Brad Davis wrote:
> > > > On Tue, Sep 07, 2010 at 08:30:25AM -0400, John Baldwin wrote:
> > > > > On Monday, September 06, 2010 11:50:07 am Brad Davis wrote:
> > > > > > The following reply was made to PR docs/108101; it has been noted by GNATS.
> > > > > > 
> > > > > > From: Brad Davis <brd at FreeBSD.org>
> > > > > > To: bug-followup at FreeBSD.org
> > > > > > Cc:  
> > > > > > Subject: Re: docs/108101: /boot/default/loader.conf contains an incorrect
> > > > > >  comment
> > > > > > Date: Mon, 6 Sep 2010 09:12:57 -0600
> > > > > > 
> > > > > >  Confirmed.
> > > > > >  
> > > > > >  Trying to find out if we can fix the loader, rather than remove the
> > > > > >  comment.
> > > > > 
> > > > > Does it work properly if you use beastie_disable="YES" in loader.conf?
> > > > 
> > > > It does.
> > > 
> > > Hmm, presumably it is a regression in beastie.4th then.  Unfortunately I do
> > > not know Forth at all.  Something like this might work:
> > > 
> > > Index: beastie.4th
> > > ===================================================================
> > > --- beastie.4th	(revision 212292)
> > > +++ beastie.4th	(working copy)
> > > @@ -241,6 +241,10 @@
> > >  		10
> > >  	else
> > >  		0 0 2swap >number drop drop drop
> > > +		dup -1 = if
> > > +			exit
> > > +		then
> > > +		drop
> > >  	then
> > >  	begin
> > >  		dup tkey
> > > 
> > > (I would test this via PXE or some such at first so you can easily back this
> > > out if it fubar's the boot process.)
> > 
> > I tested it and it seems to ignore it and start counting down anyways.
> 
> Hmmm, I'll have to think about this some more.  This code is not easy to parse. :(
> Does it still respect autoboot_delay if you set it to a non-default value?

The problem is that ">number" itself only processes unsigned values and
so doesn't process punctuation characters when doing the conversion.
Thus for "-1" (and for any string commencing with a non-digit) it
returns the initial value passed to it, 0 (the double 0 before >number).
I can put together a word to do generalised string-to-number conversion
for the bootloader if wanted. Another option is just to add an explicit
test for the "-1" string:

--- beastie.4th.orig	2009-11-22 01:00:55.000000000 +1030
+++ beastie.4th	2010-09-09 11:14:06.000000000 +0930
@@ -240,7 +240,11 @@
 		drop
 		10
 	else
-		0 0 2swap >number drop drop drop
+		2dup s" -1" compare 0= if
+			0 boot
+		else
+			0 s>d 2swap >number 2drop drop
+		then
 	then
 	begin
 		dup tkey





More information about the freebsd-doc mailing list