From owner-freebsd-bugs Fri Sep 28 10:20:14 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id E28D137B40E for ; Fri, 28 Sep 2001 10:20:00 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f8SHK0l63916; Fri, 28 Sep 2001 10:20:00 -0700 (PDT) (envelope-from gnats) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by hub.freebsd.org (Postfix) with SMTP id 68E8937B40B for ; Fri, 28 Sep 2001 10:11:46 -0700 (PDT) Received: (qmail 18449 invoked by uid 0); 28 Sep 2001 17:11:44 -0000 Received: from p3ee21603.dip.t-dialin.net (HELO mail.gsinet.sittig.org) (62.226.22.3) by mail.gmx.net (mp007-rz3) with SMTP; 28 Sep 2001 17:11:44 -0000 Received: (qmail 27332 invoked from network); 27 Sep 2001 19:22:56 -0000 Received: from shell.gsinet.sittig.org (192.168.11.153) by mail.gsinet.sittig.org with SMTP; 27 Sep 2001 19:22:56 -0000 Received: (from sittig@localhost) by shell.gsinet.sittig.org (8.11.3/8.11.3) id f8RJMu327328 for FreeBSD-gnats-submit@freebsd.org; Thu, 27 Sep 2001 21:22:56 +0200 (CEST) (envelope-from sittig) Message-Id: <20010927212255.B97313@shell.gsinet.sittig.org> Date: Thu, 27 Sep 2001 21:22:55 +0200 From: Gerhard Sittig To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/30893: [PATCH] burncd(8) progress meter Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 30893 >Category: bin >Synopsis: [PATCH] burncd(8) progress meter >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 Sep 28 10:20:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Gerhard Sittig >Release: FreeBSD 4.3-STABLE i386 >Organization: System Defenestrators Inc. >Environment: FreeBSD system with an ATAPI CD writer (thus using burncd(8) instead of cdrecord and friends) >Description: burncd(8)'s progress meter is kept in absolute (KB) and relative (%) measure when writing CD media. Should the input come from stdin (usually a pipe) or should the source file's size be indetermined(id?) (seen with /dev/acd0c) the output will show one percent for *every* KB written -- which obviously is bogus. The comment in burncd.c ack's this fact. :) >How-To-Repeat: $ SOURCE=/dev/acd0c $ burncd -e -f /dev/acd1c -s 8 data $SOURCE fixate $ $MKIMAGE | burncd -e -f /dev/acd1c -s 8 data - fixate >Fix: Apply the patch cited below. This one was done in June and went unanswered since (I take it it's my fault trying to contact sos@FreeBSD.org via PM while he's busy doing other things, so I understand this PR as being a more formal way of feedback for better record or for the option of somebody else to pick it up). The patch should apply cleanly to today's -STABLE since burncd.c didn't move since rev 1.10.2.1 (2001/02/25 21:39:13). # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # burncd.diff # echo x - burncd.diff sed 's/^X//' >burncd.diff << 'END-of-burncd.diff' XIndex: burncd.c X=================================================================== XRCS file: /CVSREPO/FreeBSD/src/usr.sbin/burncd/burncd.c,v Xretrieving revision 1.10.2.1 Xdiff -u -r1.10.2.1 burncd.c X--- burncd.c 2001/02/25 21:39:13 1.10.2.1 X+++ burncd.c 2001/06/01 19:06:10 X@@ -234,11 +234,12 @@ X void X write_file(const char *name, int block_size) X { X- int addr, count, file, filesize, size; X+ int addr, count, file, filesize, hasfilesize, size; X char buf[2352*BLOCKS]; X struct stat stat; X static int cdopen, done_stdin, tot_size = 0; X X+ hasfilesize = 1; /* assumption, to be corrected */ X if (!strcmp(name, "-")) { X if (done_stdin) { X warn("skipping multiple usages of stdin"); X@@ -246,6 +247,7 @@ X } X file = STDIN_FILENO; X done_stdin = 1; X+ hasfilesize = 0; X } X else if ((file = open(name, O_RDONLY, 0)) < 0) X err(EX_NOINPUT, "open(%s)", name); X@@ -265,6 +267,8 @@ X if (fstat(file, &stat) < 0) X err(EX_IOERR, "fstat(%s)", name); X filesize = stat.st_size / 1024; X+ if (filesize == 0) X+ hasfilesize = 0; X X if (!quiet) { X fprintf(stderr, "next writeable LBA %d\n", addr); X@@ -278,8 +282,6 @@ X X lseek(fd, addr * block_size, SEEK_SET); X size = 0; X- if (filesize == 0) X- filesize++; /* cheat, avoid divide by zero */ X X while ((count = read(file, buf, block_size * BLOCKS)) > 0) { X int res; X@@ -299,7 +301,7 @@ X int pct; X X fprintf(stderr, "written this track %d KB", size/1024); X- if (file != STDIN_FILENO) { X+ if (hasfilesize) { X pct = (size / 1024) * 100 / filesize; X fprintf(stderr, " (%d%%)", pct); X } END-of-burncd.diff exit virtually yours 82D1 9B9C 01DC 4FB4 D7B4 61BE 3F49 4F77 72DE DA76 Gerhard Sittig true | mail -s "get gpg key" Gerhard.Sittig@gmx.net -- If you don't understand or are scared by any of the above ask your parents or an adult to help you. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message