burncd write buffer overflow

Glen Wolfe g.wolfe at wojaFInc.com
Sat May 13 23:45:29 UTC 2006


Hi

I have been attempting to use burncd from FreeBSD Release 6.0 using the 
command line:

*#burncd -f /dev/acd0 -s 3 dvdrw disk_image.iso*

with repeated failure after attempting to write 890 kB to a DVD.

After adding trace modifications to the primary write loop in

int write_file(int fd, struct track_info *track_info)

in *burncd.c* viz.

------------------
        while ((count = read(track_info->file, buf,
                             track_info->file_size == -1
                                ? track_info->block_size * BLOCKS
                                : MIN((track_info->file_size - size),
                                      track_info->block_size * BLOCKS))) 
 > 0) {
                int res;

                if (count % track_info->block_size) {
                        /* pad file to % block_size */
                        bzero(&buf[count],
                              (track_info->block_size * BLOCKS) - count);
                        count = ((count / track_info->block_size) + 1) *
                                track_info->block_size;
                }
*                /* trace report */*
                fprintf(stderr, "\nAbout to write this track of %jd KB 
...\n",
                        (intmax_t)count/1024);
*                /* end trace report */*
                if ((res = write(fd, buf, count)) != count) {
                        if (res == -1)
                                fprintf(stderr, "\n%s\n", strerror(errno));
*/* ---------------------------- this error not handled ---------------- */*
*/* if buffer not fully written due to e.g. Device busy ... no recovery  */*
                        else
                                fprintf(stderr, "\nonly wrote %d of %jd 
bytes\n",
                                        res, (intmax_t)count);
                        break;
                }
                size += count;
                tot_size += count;
                if (!quiet) {
                        int pct;

                        fprintf(stderr, "written this track %jd KB",
                            (intmax_t)size/1024);
                        if (track_info->file != STDIN_FILENO && filesize) {
                                pct = (size / 1024) * 100 / filesize;
                                fprintf(stderr, " (%d%%)", pct);
                        }
                        fprintf(stderr, " total %jd KB\r",
                            (intmax_t)tot_size / 1024);
                }
                if (track_info->file_size != -1
                    && size >= track_info->file_size)
                        break;
        }

----------------------------

the following output is observed:

--------------------------

# burncd/burncd -f /dev/acd0 -s 3 dvdrw fBSD_sys_cd.iso
Writing track 0 of 1 ...
next writeable LBA 0
writing from file fBSD_sys_cd.iso size 3111668 KB

About to write this track of 32 KB ...
written this track 32 KB (0%) total 32 KB
About to write this track of 32 KB ...
written this track 64 KB (0%) total 64 KB
About to write this track of 32 KB ...
written this track 96 KB (0%) total 96 KB
About to write this track of 32 KB ...
written this track 128 KB (0%) total 128 KB
About to write this track of 32 KB ...
written this track 160 KB (0%) total 160 KB
About to write this track of 32 KB ...
written this track 192 KB (0%) total 192 KB
About to write this track of 32 KB ...
written this track 224 KB (0%) total 224 KB
About to write this track of 32 KB ...
written this track 256 KB (0%) total 256 KB
About to write this track of 32 KB ...
written this track 288 KB (0%) total 288 KB
About to write this track of 32 KB ...
written this track 320 KB (0%) total 320 KB
About to write this track of 32 KB ...
written this track 352 KB (0%) total 352 KB
About to write this track of 32 KB ...
written this track 384 KB (0%) total 384 KB
About to write this track of 32 KB ...
written this track 416 KB (0%) total 416 KB
About to write this track of 32 KB ...
written this track 448 KB (0%) total 448 KB
About to write this track of 32 KB ...
written this track 480 KB (0%) total 480 KB
About to write this track of 32 KB ...
written this track 512 KB (0%) total 512 KB
About to write this track of 32 KB ...
written this track 544 KB (0%) total 544 KB
About to write this track of 32 KB ...
written this track 576 KB (0%) total 576 KB
About to write this track of 32 KB ...
written this track 608 KB (0%) total 608 KB
About to write this track of 32 KB ...
written this track 640 KB (0%) total 640 KB
About to write this track of 32 KB ...
written this track 672 KB (0%) total 672 KB
About to write this track of 32 KB ...
written this track 704 KB (0%) total 704 KB
About to write this track of 32 KB ...
written this track 736 KB (0%) total 736 KB
About to write this track of 32 KB ...
written this track 768 KB (0%) total 768 KB
About to write this track of 32 KB ...
written this track 800 KB (0%) total 800 KB
About to write this track of 32 KB ...
written this track 832 KB (0%) total 832 KB
About to write this track of 32 KB ...
written this track 864 KB (0%) total 864 KB
About to write this track of 32 KB ...
written this track 896 KB (0%) total 896 KB
About to write this track of 32 KB ...

Device busy

burncd: ioctl(CDRIOCFLUSH): Input/output error

--------------------------

This appears to me that the partial buffer write failure error is not 
handled adequately, or that the write speed is too fast (thus causing 
the error in the first place). As this error is not dependant on the 
speed (*-s*) option passed to *burncd*, can anyone make any comment on 
the appropriate error handling here, or the write speed setting 
mechanism in the cd/dvd writer device driver?

*ad*thanks*vance
*
Glen*
*
-- 




	


	



Glen Wolfe

g.wolfe at wojaFInc.com <mailto:g.wolfe at wojaFInc.com>

Ph +61-433 774 535

	

<http://www.wojaFInc.com/>



------------------------------------------------------------------------

This private and confidential email has been sent in good faith that the 
addressee/s is/are to be its only viewer/s, even though transmitted 
unencrypted over public networks. If you are not the intended recipient, 
it would be appreciated if you would delete all copies (including 
attachments) that you possess, and contact the sender to make 
notification of this privacy failure. Thank you.

------------------------------------------------------------------------





More information about the freebsd-bugs mailing list