Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Jan 2012 17:46:27 -0800
From:      Devin Teske <devin.teske@fisglobal.com>
To:        Sergey Kandaurov <pluknet@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dimitry Andric <dim@freebsd.org>
Subject:   Re: svn commit: r228985 - head/sys/boot/forth
Message-ID:  <2C0D66FB-4056-45FB-998C-4234C3E13B6F@fisglobal.com>
In-Reply-To: <CAE-mSOJS5a%2BxCTFmtUL3R%2B3VZJupgDo7eFbAc70wmtWRW6s-3Q@mail.gmail.com>
References:  <201112300624.pBU6OxO9098906@svn.freebsd.org> <4F08A518.8090207@FreeBSD.org> <CAE-mSOJS5a%2BxCTFmtUL3R%2B3VZJupgDo7eFbAc70wmtWRW6s-3Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Jan 8, 2012, at 12:35 PM, Sergey Kandaurov wrote:

> On 8 January 2012 00:03, Dimitry Andric <dim@freebsd.org> wrote:
>> On 2011-12-30 07:24, Sergey Kandaurov wrote:
>>>=20
>>> Author: pluknet
>>> Date: Fri Dec 30 06:24:59 2011
>>> New Revision: 228985
>>> URL: http://svn.freebsd.org/changeset/base/228985
>>>=20
>>> Log:
>>>   Unset the environment variables associated with individual menu items
>>>   before invoking the kernel.
>>=20
>>=20
>> When I did a single-user mode boot to install a new world, I saw the
>> following warning on the (serial) console during boot:
>>=20
>>  /boot.config: -D -S115200
>>  Consoles: internal video/keyboard  serial port
>>  BIOS drive A: is disk0
>>  BIOS drive C: is disk1
>>  BIOS 638kB/3143616kB available memory
>>=20
>>  FreeBSD/x86 bootstrap loader, Revision 1.1
>>  (dim@vm-freebsd10-amd64.home.andric.com, Sat Jan  7 01:05:07 CET 2012)
>>  Loading /boot/defaults/loader.conf
>>  /boot/kernel/kernel data=3D0xb73530 data=3D0x11dbe0+0x2b4db8
>> syms=3D[0x8+0xfd620+0x8+0xec6b6]
>>  -
>>  Hit [Enter] to boot immediately, or any other key for command prompt.
>>=20
>>=20
>>  Type '?' for a list of commands, 'help' for more detailed help.
>>  OK boot -s
>>  menu-unset not found           <<-- what's this?
>>  GDB: no debug ports present
>>  KDB: debugger backends: ddb
>>  KDB: current backend: ddb
>>  [...kernel boots...]
>>=20
>> E.g, it always gives a 'menu-unset not found' warning (or maybe it's an
>> error, it's not clear).  This was not the case before r228985.
>>=20
>> I have almost no knowledge about forth, but it looks like this might be
>> caused by the new try-menu-unset subroutine.
>>=20
>> My loader.conf is just this:
>>=20
>>  beastie_disable=3D"YES"
>>  comconsole_speed=3D"115200"
>>  console=3D"comconsole vidconsole"
>>  kern.hz=3D"100"
>=20
> So, the problem arise when beastie_disable is set.
>=20
> In this case menu.rc is not evaluated and consequently menu-unset does
> not have a body yet. This results in the ficl warning "not found" when
> try-menu-unset calls menu-unset. The warning cannot be handled with catch
> as seen with the code in head.
> Otherwise, when beastie is enabled, all works as it should.
>=20
> To "fix" the problem I replaced 'catch' with 'sfind', so that we can
> conditionally call menu-unset only when the definition is present.
>=20
> Please try the following patch. I tested it with enabled/disabled beastie
> and loader_color over serial console. I would also like to get a review
> from Devin Teske to see if this change is acceptable.
>=20
> %%%
> Index: sys/boot/forth/loader.4th
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- sys/boot/forth/loader.4th   (revision 229670)
> +++ sys/boot/forth/loader.4th   (working copy)
> @@ -45,8 +45,10 @@
>=20
> : try-menu-unset
>   s" menu-unset"
> -  ['] evaluate catch if
> -    2drop
> +  sfind if
> +    execute
> +  else
> +    drop
>   then
> ;
>=20
> %%%
>=20

I've reviewed the patch, but also submitted my solution as PR amd64/163938.

However, I love your use of sfind -- it's perfect. Nice job!

I'm incorporating your patch into my patch for PR amd64/163938 for posterit=
y measures and historical archiving.

Please review in a few moments after submission of my followup.



> [ It could be simplified with one-liner:
> s" menu-unset" sfind drop execute
> but ficl doesn't like this in a freestanding environment.]
>=20

Nah, multi-line is perfectly fine.
--=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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2C0D66FB-4056-45FB-998C-4234C3E13B6F>