From swear@blarg.net  Sat Mar 30 23:21:55 2002
Return-Path: <swear@blarg.net>
Received: from lists.blarg.net (lists.blarg.net [206.124.128.17])
	by hub.freebsd.org (Postfix) with ESMTP id 07F3C37B41E
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 30 Mar 2002 23:21:34 -0800 (PST)
Received: from thig.blarg.net (thig.blarg.net [206.124.128.18])
	by lists.blarg.net (Postfix) with ESMTP id B7BC6BD2F
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 30 Mar 2002 23:21:33 -0800 (PST)
Received: from localhost.localdomain ([206.124.139.115])
	by thig.blarg.net (8.9.3/8.9.3) with ESMTP id XAA08669
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 30 Mar 2002 23:21:33 -0800
Received: (from jojo@localhost)
	by localhost.localdomain (8.11.6/8.11.3) id g2V7Jre42696;
	Sat, 30 Mar 2002 23:19:53 -0800 (PST)
	(envelope-from swear@blarg.net)
Message-Id: <898z89b3vr.z89@localhost.localdomain>
Date: 30 Mar 2002 23:19:52 -0800
From: "Gary W. Swearingen" <swear@blarg.net>
Reply-To: swear@blarg.net
To: FreeBSD-gnats-submit@freebsd.org
Subject: fdisk(8) program doesn't honor -t (test) when using -I.
X-GNATS-Notify:

>Number:         36563
>Category:       docs
>Synopsis:       fdisk(8) program doesn't honor -t (test) when using -I.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    trhodes
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 30 23:30:01 PST 2002
>Closed-Date:    Thu Apr 25 14:10:26 PDT 2002
>Last-Modified:  Thu Apr 25 14:10:26 PDT 2002
>Originator:     Gary W. Swearingen
>Release:        FreeBSD 4.5-STABLE i386
>Organization:
none
>Environment:
n/a
================
>Description:

The fdisk(8) program's man page says it doesn't write the partition
table when the -t option is used, but it does do so if the -I option is
also used, or at least that seems clear to me from the -I code in the
"main" function in "/usr/src/sbin/i386/fdisk/fdisk.c" and following the
functions calls to write_s0 and write_disk which don't use the "t_flag"
to protect against writing the partition table.

(The .../pc98/... version doesn't have a -I option.)
================
>How-To-Repeat:
If you have a free disk that can have all it's data destroyed,
you could try "fdisk -I -t <disk-to-wipe-out>".
================
>Fix:
(untested)

--- /usr/src/sbin/i386/fdisk/fdisk.c    Sat Mar  2 15:58:41 2002
+++ /tmp/fdisk.c        Sat Mar 30 23:16:14 2002
@@ -346,7 +346,10 @@
                dos(partp);
                if (v_flag)
                        print_s0(-1);
-               write_s0();
+               if (!t_flag)
+               {
+                       write_s0();
+               }
                exit(0);
        }
        if (f_flag)
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: trhodes 
State-Changed-When: Tue Apr 16 14:23:03 PDT 2002 
State-Changed-Why:  
A talk with bde has started a reaction which will lead to the closing of 
all current fdisk(8) PR's. 


Responsible-Changed-From-To: freebsd-doc->trhodes 
Responsible-Changed-By: trhodes 
Responsible-Changed-When: Tue Apr 16 14:23:03 PDT 2002 
Responsible-Changed-Why:  
A talk with bde has started a reaction which will lead to the closing of 
all current fdisk(8) PR's. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=36563 
State-Changed-From-To: analyzed->patched 
State-Changed-By: trhodes 
State-Changed-When: Thu Apr 18 09:28:08 PDT 2002 
State-Changed-Why:  
I have applied a different patch to CURRENT which fixes the problem.  Thanks 
for the submission! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=36563 
State-Changed-From-To: patched->closed 
State-Changed-By: trhodes 
State-Changed-When: Thu Apr 25 14:09:35 PDT 2002 
State-Changed-Why:  
A slightly different patch committed to current and stable, one that 
conformed more towards style(9).  Thanks alot for pointing this out! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=36563 
>Unformatted:
