NetBSD Problem Report #44562

From campbell@mumble.net  Sun Feb 13 17:47:16 2011
Return-Path: <campbell@mumble.net>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 6240763B8BA
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 13 Feb 2011 17:47:16 +0000 (UTC)
Message-Id: <20110213174714.5481598298@pluto.mumble.net>
Date: Sun, 13 Feb 2011 17:47:14 +0000 (UTC)
From: Taylor R Campbell <campbell+netbsd@mumble.net>
Reply-To: Taylor R Campbell <campbell+netbsd@mumble.net>
To: gnats-bugs@gnats.NetBSD.org
Subject: boot loader's `boot' command doesn't try netbsd.old &c.
X-Send-Pr-Version: 3.95

>Number:         44562
>Category:       port-i386
>Synopsis:       boot loader's `boot' command doesn't try netbsd.old &c.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-i386-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 13 17:50:00 +0000 2011
>Closed-Date:    Sun Nov 25 18:16:18 +0000 2018
>Last-Modified:  Sun Nov 25 18:16:18 +0000 2018
>Originator:     Taylor R Campbell <campbell+netbsd@mumble.net>
>Release:        NetBSD 5.1_STABLE
>Organization:
>Environment:
System: NetBSD smalltalk.local 5.1_STABLE NetBSD 5.1_STABLE (RIADEBUG) #0: Tue Feb 1 20:28:45 UTC 2011 root@smalltalk.local:/home/riastradh/netbsd/5/obj/sys/arch/i386/compile/RIADEBUG i386
Architecture: i386
Machine: i386
>Description:

	The i386/boot(8) man page claims that the `boot' command with
	no file name argument will try to boot netbsd, netbsd.gz,
	netbsd.old, netbsd.old.gz, onetbsd, and then onetbsd.gz, in
	that order.  Instead, it tries only netbsd.

>How-To-Repeat:

	Leave an old kernel in /netbsd.old.  Move /netbsd out of the
	way to try using the old kernel.  Reboot.  Realize that you
	have just rendered the machine unbootable, because it is a
	MacBook on which the boot loader prompt's keyboard input is
	broken so you can't just type `boot netbsd.old'.

	Curse profusely.

>Fix:

	Apply the following patch to sys/arch/i386/stand/boot/boot2.c.
	I have not tested this, but I have tested the next patch on
	netbsd-5.

	Patch to HEAD (untested):

Index: boot2.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/boot/boot2.c,v
retrieving revision 1.52
diff -p -u -r1.52 boot2.c
--- boot2.c	6 Feb 2011 23:16:05 -0000	1.52
+++ boot2.c	13 Feb 2011 17:39:35 -0000
@@ -421,10 +421,21 @@ void
 command_boot(char *arg)
 {
 	char *filename;
-	int howto;
+	int howto, tell;

-	if (parseboot(arg, &filename, &howto))
-		bootit(filename, howto, (howto & AB_VERBOSE) != 0);
+	if (!parseboot(arg, &filename, &howto))
+		return;
+
+	tell = ((howto & AB_VERBOSE) != 0);
+	if (filename != NULL) {
+		bootit(filename, howto, tell);
+	} else {
+		int i;
+		for (i = 0; i < NUMNAMES; i++) {
+			bootit(names[i][0], howto, tell);
+			bootit(names[i][1], howto, tell);
+		}
+	}
 }

 void

	Patch to netbsd-5 (tested):

Index: boot2.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/boot/boot2.c,v
retrieving revision 1.38.4.2
diff -p -u -r1.38.4.2 boot2.c
--- boot2.c	14 Feb 2010 14:01:08 -0000	1.38.4.2
+++ boot2.c	13 Feb 2011 17:36:11 -0000
@@ -742,8 +742,18 @@ command_boot(char *arg)
 	char *filename;
 	int howto;

-	if (parseboot(arg, &filename, &howto))
+	if (!parseboot(arg, &filename, &howto))
+		return;
+
+	if (filename != NULL) {
 		bootit(filename, howto, 1);
+	} else {
+		int i;
+		for (i = 0; i < NUMNAMES; i++) {
+			bootit(names[i][0], howto, 1);
+			bootit(names[i][1], howto, 1);
+		}
+	}
 }

 void

>Release-Note:

>Audit-Trail:
From: Taylor R Campbell <campbell+netbsd@mumble.net>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-i386/44562: boot loader's `boot' command doesn't try netbsd.old &c.
Date: Sun, 13 Feb 2011 17:58:54 +0000

 I forgot to add:  The order is actually netbsd, netbsd.gz, onetbsd,
 onetbsd.gz, netbsd.old, and netbsd.old.gz, but the man page claims
 that netbsd.old comes before onetbsd.  I don't care which comes first,
 but it might be nice to fix this minor discrepancy while we're at it
 fixing the major discrepancy.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44562 CVS commit: src/sys/arch/i386/stand/boot
Date: Sat, 4 Aug 2012 03:51:28 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Sat Aug  4 03:51:28 UTC 2012

 Modified Files:
 	src/sys/arch/i386/stand/boot: boot2.c

 Log Message:
 Fix i386 `boot' command to try the usual set of kernel names.

 Without this, the `boot' command will try only `netbsd', not
 `netbsd.gz', `netbsd.old', &c.

 Patch from PR port-i386/44562.


 To generate a diff of this commit:
 cvs rdiff -u -r1.57 -r1.58 src/sys/arch/i386/stand/boot/boot2.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44562 CVS commit: [netbsd-6] src/sys/arch/i386/stand/boot
Date: Sun, 12 Aug 2012 18:56:54 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sun Aug 12 18:56:54 UTC 2012

 Modified Files:
 	src/sys/arch/i386/stand/boot [netbsd-6]: boot2.c

 Log Message:
 Pull up following revision(s) (requested by riastradh in ticket #479):
 	sys/arch/i386/stand/boot/boot2.c: revision 1.58
 Fix i386 `boot' command to try the usual set of kernel names.
 Without this, the `boot' command will try only `netbsd', not
 `netbsd.gz', `netbsd.old', &c.
 Patch from PR port-i386/44562.


 To generate a diff of this commit:
 cvs rdiff -u -r1.57 -r1.57.2.1 src/sys/arch/i386/stand/boot/boot2.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-i386/44562: boot loader's `boot' command doesn't try
 netbsd.old &c.
Date: Mon, 13 Aug 2012 19:45:05 +0000

 On Sun, Feb 13, 2011 at 05:50:01PM +0000, Taylor R Campbell wrote:
  > 	Apply the following patch to sys/arch/i386/stand/boot/boot2.c.
  > 	I have not tested this, but I have tested the next patch on
  > 	netbsd-5.

 I see no pullup entry for this in the netbsd-5 queue; did you mean to
 send one?

 -- 
 David A. Holland
 dholland@netbsd.org

State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sun, 25 Nov 2018 18:16:18 +0000
State-Changed-Why:
Now it is all fixed. thanks for the report.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.