Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jun 1998 10:12:56 +0200 (CEST)
From:      blank@fox.uni-trier.de (Sascha Blank)
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/6995: Minor flaw in fdformat
Message-ID:  <199806190812.KAA01446@sliphost37.uni-trier.de>

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

>Number:         6995
>Category:       bin
>Synopsis:       Minor flaw in fdformat
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 19 04:40:03 PDT 1998
>Last-Modified:
>Originator:     Sascha Blank
>Organization:
>Release:        FreeBSD 2.2.6-STABLE i386
>Environment:

A very recent FreeBSD 2.2-STABLE system.  As the file
/usr/src/usr.sbin/fdformat/fdformat.c has no RCS identifier, I use the
file size and md5 sum instead.

% ls -l /usr/src/usr.sbin/fdformat/fdformat.c
-rw-r--r--  1 blank  blank  8709 17 Jun 10:26 fdformat.c
% md5 /usr/src/usr.sbin/fdformat/fdformat.c
MD5 (fdformat.c) = 8046542311740db36fad2401e6a76bcc

>Description:

fdformat prints a line of hyphens that it turns into status characters
one by one to show how far the formatting process has already proceeded.
It always prints exactly 40 hyphens assuming that the disk to be
formatted will have 80 tracks.  But this assumption is wrong if you
format a disk using a higher capacity like 1720k (which goes by 82
tracks).  In this case 41 status characters will be printed over the 40
hyphens printed at the beginning.

>How-To-Repeat:

Format a disk using the 1720k option of fdformat and watch the output,
when the last tracks are formatted.

>Fix:
	
The calculation how many status characters are needed is already
correct, so we use the same algorithm to calculate how many hyphens
should be printed at the beginning.

This flaw is likely to be present in 3.0-CURRENT as well.

*** fdformat.c.ctm	Wed Jun 17 10:26:24 1998
--- fdformat.c	Wed Jun 17 10:30:10 1998
***************
*** 299,306 ****
  	 * Formatting.
  	 */
  	if(!quiet) {
- 		printf("Processing ----------------------------------------\r");
  		printf("Processing ");
  		fflush(stdout);
  	}
  
--- 299,311 ----
  	 * Formatting.
  	 */
  	if(!quiet) {
  		printf("Processing ");
+ 		for (track = 0; track < fdt.tracks * fdt.heads; track++) {
+ 			if (!((track + 1) % tracks_per_dot)) {
+ 				putchar('-');
+ 			}
+ 		}
+ 		printf("\rProcessing ");
  		fflush(stdout);
  	}
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806190812.KAA01446>