Andreas Klauer <[EMAIL PROTECTED]> writes:

> I'm trying to get growisofs to work together with pipebuf2 [1]
> and could use some help here, since I'm experiencing problems.
> 
> The command line I use is:
> cat DVD.iso | pipebuf2 -b 32 | growisofs -dvd-compat -Z /dev/sr0=/dev/fd/0
> 
> The writing process seems to work, as no errors are reported, however the
> result is always partially corrupt when using this method. Wrong data is
> spread all over the disk. However, if I redirect the pipebuf2 output into
> a regular file instead of piping to growisofs, the result is valid. So if
> it's a bug in pipebuf2, it only occurs under special circumstances...
...
> Additional information about my system:
>     Athlon XP 2000+, Gentoo, Kernel 2.6.2

It is a bug in pipebuf2 that is triggered by the smarter handling of
pipes in the 2.6 kernel. I've uploaded a fixed version:

        http://w1.894.telia.com/~u89404340/pipebuf2.c

The bug fix looks like this:

--- pipebuf2.c~ 2004-01-06 14:00:27.000000000 +0100
+++ pipebuf2.c  2004-02-23 20:53:57.000000000 +0100
@@ -117,7 +117,7 @@
        if (ret > 0) {
            if (FD_ISSET(STDIN_FILENO, &readfds)) {
                int readPos = (bufPos + dataLen) % bufSize;
-               int maxLen = bufSize - readPos;
+               int maxLen = MIN(bufSize - readPos, bufSize - dataLen);
                ret = read(STDIN_FILENO, &buffer[readPos], maxLen);
                if (ret < 0) {
                    if ((errno != EINTR) && (errno != EAGAIN)) {

-- 
Peter Osterlund - [EMAIL PROTECTED]
http://w1.894.telia.com/~u89404340

Reply via email to