svn commit: r228985 - head/sys/boot/forth

Devin Teske devin.teske at fisglobal.com
Mon Jan 9 02:22:27 UTC 2012


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

> On 8 January 2012 00:03, Dimitry Andric <dim at freebsd.org> wrote:
>> On 2011-12-30 07:24, Sergey Kandaurov wrote:
>>> 
>>> Author: pluknet
>>> Date: Fri Dec 30 06:24:59 2011
>>> New Revision: 228985
>>> URL: http://svn.freebsd.org/changeset/base/228985
>>> 
>>> Log:
>>>   Unset the environment variables associated with individual menu items
>>>   before invoking the kernel.
>> 
>> 
>> When I did a single-user mode boot to install a new world, I saw the
>> following warning on the (serial) console during boot:
>> 
>>  /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
>> 
>>  FreeBSD/x86 bootstrap loader, Revision 1.1
>>  (dim at vm-freebsd10-amd64.home.andric.com, Sat Jan  7 01:05:07 CET 2012)
>>  Loading /boot/defaults/loader.conf
>>  /boot/kernel/kernel data=0xb73530 data=0x11dbe0+0x2b4db8
>> syms=[0x8+0xfd620+0x8+0xec6b6]
>>  -
>>  Hit [Enter] to boot immediately, or any other key for command prompt.
>> 
>> 
>>  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...]
>> 
>> 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.
>> 
>> I have almost no knowledge about forth, but it looks like this might be
>> caused by the new try-menu-unset subroutine.
>> 
>> My loader.conf is just this:
>> 
>>  beastie_disable="YES"
>>  comconsole_speed="115200"
>>  console="comconsole vidconsole"
>>  kern.hz="100"
> 
> So, the problem arise when beastie_disable is set.
> 
> 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.
> 
> To "fix" the problem I replaced 'catch' with 'sfind', so that we can
> conditionally call menu-unset only when the definition is present.
> 
> 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.
> 
> %%%
> Index: sys/boot/forth/loader.4th
> ===================================================================
> --- sys/boot/forth/loader.4th   (revision 229670)
> +++ sys/boot/forth/loader.4th   (working copy)
> @@ -45,8 +45,10 @@
> 
> : try-menu-unset
>   s" menu-unset"
> -  ['] evaluate catch if
> -    2drop
> +  sfind if
> +    execute
> +  else
> +    drop
>   then
> ;
> 
> %%%
> 

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 posterity 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.]
> 

Nah, multi-line is perfectly fine.
-- 
Devin

_____________
The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.


More information about the svn-src-all mailing list