From owner-freebsd-bugs Fri Jun 19 04:41:40 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id EAA22243 for freebsd-bugs-outgoing; Fri, 19 Jun 1998 04:41:40 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA22203 for ; Fri, 19 Jun 1998 04:41:25 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id EAA19268; Fri, 19 Jun 1998 04:40:03 -0700 (PDT) Received: from sliphost37.uni-trier.de (root@sliphost37.uni-trier.de [136.199.240.37]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA21571 for ; Fri, 19 Jun 1998 04:37:42 -0700 (PDT) (envelope-from blank@sliphost37.uni-trier.de) Received: (from blank@localhost) by sliphost37.uni-trier.de (8.8.8/8.8.8) id KAA01446; Fri, 19 Jun 1998 10:12:56 +0200 (CEST) (envelope-from blank) Message-Id: <199806190812.KAA01446@sliphost37.uni-trier.de> Date: Fri, 19 Jun 1998 10:12:56 +0200 (CEST) From: blank@fox.uni-trier.de (Sascha Blank) Reply-To: blank@fox.uni-trier.de (Sascha Blank) To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/6995: Minor flaw in fdformat Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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