Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Sep 2001 21:22:55 +0200
From:      Gerhard Sittig <Gerhard.Sittig@gmx.net>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/30893: [PATCH] burncd(8) progress meter
Message-ID:  <20010927212255.B97313@shell.gsinet.sittig.org>

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

>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 <Gerhard.Sittig@gmx.net>
>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




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