Subject: bin/4893: fdisk -S shouldn't output non-sh code
To: None <gnats-bugs@gnats.netbsd.org>
From: Nathan J. Williams <nathanw@mit.edu>
List: netbsd-bugs
Date: 01/25/1998 23:07:47
>Number: 4893
>Category: bin
>Synopsis: fdisk -S shouldn't output non-sh code
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Jan 25 20:20:01 1998
>Last-Modified:
>Originator: Nathan J. Williams
>Organization:
Massachvsetts Institvte of Technology
>Release: NetBSD-1.3 <NetBSD-current source date>
>Environment:
System: NetBSD road-runner-w20 1.3 NetBSD 1.3 (ROAD-RUNNER) #91: Mon Jan 5 13:47:52 EST 1998 nathanw@road-runner.mit.edu:/u1/usr/src/sys/arch/i386/compile/ROAD-RUNNER i386
>Description:
Running "fdisk -S" on a disk with no DOS partition table results
in the line "DOS partition table initialized." being printed, along with
the usual variable-setting outpt. This breaks script fragments like
eval `fdisk -S $disk`, which is the sort of use that the -S option is
intended for.
>How-To-Repeat:
Run "fdisk -S" on a disk with no PC-style partition table.
>Fix:
Apply this patch to fdisk.c:
*** fdisk.c.orig Sun Jan 25 23:01:47 1998
--- fdisk.c Sun Jan 25 23:02:10 1998
***************
*** 513,519 ****
dos(getlong(&partp->dp_start) + getlong(&partp->dp_size) - 1,
&partp->dp_ecyl, &partp->dp_ehd, &partp->dp_esect);
! printf ("DOS partition table initialized.\n");
}
/* Prerequisite: the disklabel parameters and master boot record must
--- 513,520 ----
dos(getlong(&partp->dp_start) + getlong(&partp->dp_size) - 1,
&partp->dp_ecyl, &partp->dp_ehd, &partp->dp_esect);
! if (!sh_flag)
! printf ("DOS partition table initialized.\n");
}
/* Prerequisite: the disklabel parameters and master boot record must
>Audit-Trail:
>Unformatted:
Running "fdisk -S" on a disk with no DOS partition table results in bad output.