Bug 139084 - Data verification often fails (but the data written are OK)
Summary: Data verification often fails (but the data written are OK)
Status: RESOLVED FIXED
Alias: None
Product: k3b
Classification: Applications
Component: Verfication (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Sebastian Trueg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-21 09:52 UTC by Francesco Locunto
Modified: 2007-02-15 19:31 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
debugging patch against K3b 1.0rc6 (7.48 KB, patch)
2007-02-12 19:08 UTC, Sebastian Trueg
Details
attachment for # 139084 (255.22 KB, text/plain)
2007-02-13 01:55 UTC, Klaus Goebke
Details
Debug window output (255.71 KB, text/plain)
2007-02-13 09:19 UTC, Francesco Locunto
Details
Console output (44.79 KB, text/plain)
2007-02-13 09:21 UTC, Francesco Locunto
Details
Properly determine the size of a Video DVD project before burning (8.96 KB, patch)
2007-02-13 13:13 UTC, Sebastian Trueg
Details
Maybe the bugfix? (9.15 KB, patch)
2007-02-13 20:25 UTC, Sebastian Trueg
Details
k3b lastlog (53.58 KB, text/plain)
2007-02-14 11:52 UTC, Francesco Locunto
Details
Yet another attempt for a fix (11.95 KB, patch)
2007-02-14 13:49 UTC, Sebastian Trueg
Details
k3b protocol - patch-4 (253.33 KB, text/plain)
2007-02-14 19:57 UTC, Klaus Goebke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Francesco Locunto 2006-12-21 09:52:52 UTC
Version:           1.0rc2 (using KDE KDE 3.5.5)
Installed from:    SuSE RPMs
OS:                Linux

After the creation of a DVD (copied on the fly from another DVD or from hard disk without creating image), data verification often fails (it terminates, but the result is an error), but the data written are OK (tested on 7 different DVDs). Very rarely, the verification ends with good result: this problem doesn't happen with CD verification, but only with DVD (at least for me).
By now, I've burned 8 DVD with K3b 1.0rc2, 3 with "DVD copy", 5 with a "DVD data project", and only one of them passed data verification (but all 8 are OK, I've tried to copy them on HD and verified manually with "diff" and MD5.
This problem never happened with k3b 0.12.17 (with the old verification procedure).
I'm using Sony DVD+R 8x media and Philips DVD+RW 4x media on a Samsung DVD recorder (firmware: TSSTcorp CD/DVDW TS-H552B)
Comment 1 Sebastian Trueg 2006-12-21 10:03:47 UTC
The dvd project problem is already fixed. I am not sure about the DVD Copy. I did not know there were problems, too.
Could you please try the current svn?
Comment 2 Francesco Locunto 2006-12-21 10:18:27 UTC
I'll give it a try as soon as possible. Thanks for the good work!
Comment 3 Francesco Locunto 2006-12-21 12:16:53 UTC
With current SVN, also the DVD Copy (on the fly) verification works. By now I've tested only 2 times, but with the same files that have given errors before.
Comment 4 Sebastian Trueg 2006-12-21 12:24:42 UTC
great. thanks.
Comment 5 Piotr Stachura 2007-01-24 16:59:14 UTC
Hi, I saw that status of this bug is RESOLVED but verification in 1.0_rc4 fails.
Mayby it's different component but I don't like to open new bug.
Issue:
When I burn DVD/CD from image, verification ALWAYS fails.
I noticed that it's releated to image size (image on medium is longer for 1 sector <2048B>). That "extra" sector is all covered by zeros, but it makes verification to fail.
Data is of course good.
Comment 6 Sebastian Trueg 2007-01-24 18:39:21 UTC
Thanks for the hint. I always focused on the project verification. I found the 
bug and fixed it.
Comment 7 Francesco Locunto 2007-02-03 18:21:04 UTC
Data verification failed again on a DVD project (files on the hard disk burned on a DVD-R 8x DVD).
I'm using 1.0rc5 form packman rpm (openSUSE 10.2 packman repository).

NOTE: if this can help, files are > 600MB (one of these is 1,2 Gb large).
Comment 8 Francesco Locunto 2007-02-03 21:48:36 UTC
I've tested a bit this problem.
It seems that the problem happens only with DVD-R discs.
I've tried to burn the same DVD project on 4 DVD (2 DVD+R, 2 DVD-r):
with DVD+R, the verification ends with success, with DVD-R the verification fails.
I hope this help...
Comment 9 Francesco Locunto 2007-02-04 14:55:56 UTC
Another thing that I've noted:
verification fails also with DVD+R in multisession (or Auto) mode. In "No multisession mode" all is ok.
With DVD-R the verification fails also with "No multisession" mode.
Comment 10 Francesco Locunto 2007-02-04 16:45:54 UTC
Mmmh, verification failed again, on DVD+R with "No Multisession" mode.
So, I think the problem happens randomly...
Comment 11 Sebastian Trueg 2007-02-05 09:50:32 UTC
And you tested the data manually afterwards?
Comment 12 Sebastian Trueg 2007-02-05 12:51:53 UTC
I did some more tests myself and all were successfully verified:

* DVD+RW thousands of small files (approx 3.5 GB)
* DVD-R one file (1.5 GB) multisession
* DVD-R multiple big files append session
* DVD+R multiple files multisession
* DVD+R append session
Comment 13 Francesco Locunto 2007-02-05 14:47:02 UTC
I've tested the data manually (with md5sum -b) on all the DVD marked invalid by k3b 1.0rc5 verification process, and all data were valid.
This with 4 DVD over 6 DVD totally burned (2 DVD passed data verification normally).
Maybe my version (installed through Packman opensuse 10.2 repository) is unfixed?
I'll try with current SVN version and I'll report the test results made with that.
Comment 14 Francesco Locunto 2007-02-06 13:14:11 UTC
I've burned 3 DVD+3 using current k3b SVN.
2 of 3 are ok, on the third data verification fails (but the data are ok, checked by md5sum -b.
The burning process I've used is:
1) Open the program, burn the first DVD, close the program.
2) Open the program, burn the second DVD, close the project without closing the entire program, create a new project, burn the third DVD.

Maybe a buffer problem when burning more than one DVD in the same program session (but in two differen projects)?
In my opinion, it should be also checked the verification process on two different projects opened at the same time (for example DVD_Data0 and DVD_Data1), and also try to burn 2 different DVD using the same project (changing only the files in the project).
Comment 15 Sebastian Trueg 2007-02-06 15:41:29 UTC
> Maybe a buffer problem when burning more than one DVD in the same program
> session (but in two differen projects)? In my opinion, it should be also


I used different projects in the same session, different sessions, the same 
project, it alway verifies properly. Sorry, I cannot reproduce it. Not even 
once.

> checked the verification process on two different projects opened at the
> same time (for example DVD_Data0 and DVD_Data1), and also try to burn 2
> different DVD using the same project (changing only the files in the
> project).


I did all that and it always works...

The only thing left is that K3b does not only check the files themselves but 
also the data structures of the file system. You probably used md5sum on the 
files. Thus, you did not check the rest of the DVDs. You could verify that by 
burning with an image that you do not delete. Then compute its md5sum and 
compare it to the md5sum of the burned data. The latter can be extracted via 

dd if=/dev/xxx bs=2048 count=<size of the image as displayed by k3b or size of 
the image file divided by 2048> | md5sum -
Comment 16 Francesco Locunto 2007-02-06 16:14:22 UTC
Yes, i've used md5sum on the files. I'll try to calculate the digest on the entire image, but in this situation i think i'll close the this bug soon.
It can be a problem of my burner or something else?
Comment 17 Sebastian Trueg 2007-02-06 19:13:10 UTC
> ------- Yes, i've used md5sum on the files. I'll try to calculate the
> digest on the entire image, but in this situation i think i'll close the
> this bug soon. It can be a problem of my burner or something else?


It could be the burner although I don't get why the files are properly written 
then. Sadly I don't know of any other solution... :(
Comment 18 Francesco Locunto 2007-02-07 10:42:41 UTC
This time the problem was my burner.
I've just upgraded the burner firmware, and now data verification always works. Damned burner... :)
Comment 19 Francesco Locunto 2007-02-07 16:00:34 UTC
Just a last request: can you try to burn one or more files > 1.5 Gb but < 2 Gb with data verification enabled? 
Comment 20 Sebastian Trueg 2007-02-08 13:34:44 UTC
> ------- Just a last request: can you try to burn one or more files > 1.5 Gb
> but < 2 Gb with data verification enabled?


I did and it worked flawlessly.
Comment 21 Klaus Goebke 2007-02-12 13:38:34 UTC
Hi,
I experience the same problem with video DVD - DVD+R with rc3 and now rc6.
Speedsetting 8x of max 16x.
Crosscheck I did by comparing the VOB files. By crusader compare and by Total Commander compare. 
I burned ~100 Video DVD with Win + Nero and always verify without problem with my burner.
This morning I tested a rewritable DVD, max Speed 4x - Verify was ok.
Further help is very much welcome!

regards
Klaus
klsgbk@web.de
Comment 22 Francesco Locunto 2007-02-12 14:23:15 UTC
Sadly, I must say that the problem appeared again after fimware update.
The verification fails sometimes (normally when burning large files, for example creating a DVD with 4/5 files, each approx. 800 Mb large (or 2/3 files 1,4/2,1 Gb large).
Burning DVD with hundreds of small files, the verification works ok.
I don't know where the problem is... My burner and DVDs I'm using are described in the first posted message.
Comment 23 Sebastian Trueg 2007-02-12 19:08:58 UTC
Created attachment 19645 [details]
debugging patch against K3b 1.0rc6

Since I have no way of reproducing the verification problem but others have I
need a way to get more information. Thus, I wrote this patch which hopefully
provides this information.
Please apply it, force a failed verification run, and send me the K3b debugging
output as presented in the debugging window (not the console output, although
both might be best).
Comment 24 Klaus Goebke 2007-02-12 21:15:58 UTC
thanks Sebastian,
unfortunately there is something bad in the new source:
   "k3bactivepipe.cpp:5: error: stray '@' in program"
I tried to correct this, but have too less experience with C

regards
Comment 25 Sebastian Trueg 2007-02-12 21:33:28 UTC
you need to patch from the libk3b dir. Sorry, I forgot to mention that.
Comment 26 Klaus Goebke 2007-02-12 23:45:51 UTC
again: I am not an expert:
1. I rename your attachment to "k3bactivepipe.cpp"
2. I copy it in the dir "libk3b"
3. I leave the original "k3bactivepipe.cpp" unchanged in lib3b/tools 
4. I run ./configure > make > make install
this what you propose me to do?
or how else do I patch from libk3b dir?
Comment 27 Francesco Locunto 2007-02-12 23:58:46 UTC
Klaus, you must apply the patch via the command

patch -p0 < patchfilename

Copy the patch file in the "libk3b" directory (located in the source dir), open a console, go in that directory and launch the command above.

I'll try this patch as soon as possible.
Comment 28 Klaus Goebke 2007-02-13 01:10:14 UTC
Hi Francesco - thanks!
this is my first patch now - just compiling
should be in bed now; vacations are over :-(
Comment 29 Klaus Goebke 2007-02-13 01:55:14 UTC
Created attachment 19656 [details]
attachment for # 139084

k3b protocol
Comment 30 Klaus Goebke 2007-02-13 01:59:08 UTC
ah, my comment disappeared - once again:
the patch was successfully applied; then conf > make > make inst
however I detected no option or tick box for a forced verification.
the saved protocol is submitted anyway under #29
Comment 31 Francesco Locunto 2007-02-13 09:19:28 UTC
Created attachment 19659 [details]
Debug window output
Comment 32 Francesco Locunto 2007-02-13 09:21:31 UTC
Created attachment 19660 [details]
Console output

Althougth I've burned on the fly, I would note that the image size burned ( > 4
Gb, 5 files) is larger than the free space available on the partition
containing the temp dir.
Comment 33 Francesco Locunto 2007-02-13 09:41:22 UTC
In the debug window output, I've noted these lines:

K3bMd5Job
-----------------------
Stopped manually after 4500459520 bytes.

but the track size is 4500477952 bytes... Why was the job stopped? I've done nothing to stop the job...
Comment 34 Sebastian Trueg 2007-02-13 12:59:18 UTC
Guys, I think I found the bug. That is if verification only fails for VideoDVD projects...
Comment 35 Sebastian Trueg 2007-02-13 13:13:47 UTC
Created attachment 19661 [details]
Properly determine the size of a Video DVD project before burning

K3b actually did not use the same mkisofs parameters for the project size
calculation as it did for the actual burning. It missed the Video DVD specific
ones.
Please test if this patch (again to be applied in the libk3b folder via "patch
-p0 < patchfile") solves the verification issue.
Comment 36 Francesco Locunto 2007-02-13 17:11:28 UTC
I must say that, for me, verification fails on Data DVD Project: must I however try the patch?
Comment 37 Sebastian Trueg 2007-02-13 17:23:48 UTC
> ------- I must say that, for me, verification fails on Data DVD Project:
> must I however try the patch?


Too bad. no, the patch is only for Video DVD... I will keep on searching. But 
for that I need a failed data project run with the new output (the new patch 
also contains it)
Comment 38 Francesco Locunto 2007-02-13 18:06:20 UTC
The posted failed output was generated with the previous patch installed...
The new patch offers new debug output?
Comment 39 Sebastian Trueg 2007-02-13 18:49:24 UTC
Sorry, no, I got st mixed up. thanks, your output is very helpful.
Comment 40 Klaus Goebke 2007-02-13 20:04:39 UTC
It makes no sense to me to do further tests with new patches before I do not see the option "force a failed verification run". I raise the question and got no answer. Also my DVD stock is getting smaller ;-)
I see new libs in the k3b folders, but the menu and the output seem to remain on standard rc6. Where might be the problem?
Comment 41 Sebastian Trueg 2007-02-13 20:25:18 UTC
Created attachment 19676 [details]
Maybe the bugfix?

Although I don't understand why yet this could be the fix. Please test.
Comment 42 Klaus Goebke 2007-02-13 20:52:51 UTC
when I start k3b from menue, it starts fine; when I start from bash /opt/kde3/bin, I get the message "unable to find growisofs exec".  
Per google I find at lot about it, but no clear clue.
As mentioned above, I do not see another behaviour or menu after the first (!!) patch.
I know, this is not a hotline here: But if there is no help for engaged users, who were trying to help, then there is still win-xp for me to help.
Comment 43 Sebastian Trueg 2007-02-13 21:04:41 UTC
You already wrote before: "I detected no option or tick box for a forced verification". And now: "It makes no sense to me to do further tests with new patches before I do not see the option "force a failed verification run"." What do you mean?

Please try the latest patch. Since for me verification ALWAYS succeeds I have no way of testing it myself I have to rely on your tests. Thanks a lot.

As for the growisofs issue: same here. No way to test that for me as it always works here, however I start K3b.
Comment 44 Francesco Locunto 2007-02-14 00:25:40 UTC
Klaus, the proposed patch doesn't change anything on k3b interface. Sebastian wanted to say "Try burning DVD (rewriteable DVD if your stock is low ;)) until you get a verification error: in that case, post the debugging output (you can save it via the button "Debug output..." located in the k3b burning window)."
There is no additional window/control applying the patch, simply it adds some extra debug text in the "Debug Output" window ;)

For me, i'll soon apply the last patch and post the results when a failure happens.
Comment 45 Klaus Goebke 2007-02-14 01:47:26 UTC
thanks for your comments. 
forced verify: I understood something extra would come up like verifying now sector 1, 2, 3 - not the regular verify box. Thats why I was unsure, whether I was working with the patched version at all. 
Anyway I attached the output of a failed verify after my test (19656) of patch 1 with message #29.
Now in between I tested the recent patch nbr 3 (from att 19676):
In the menu output it said "verifying track 1". However after 100% verify
the clock continued counting. About 2 minutes later it seemed, that the seconds moved faster in .5 seconds pace.
I waited 10 minutes, then I pressed the abort button and the red "failed line" was displayed. I was a bit confused - and I believe there was no possibility to save a protocol.
Comment 46 Francesco Locunto 2007-02-14 11:05:59 UTC
Same thing for me: with the new patch (id=19676) data verification never ends... I would ask: the output done with the patch id=19645 isn't suffucient to inspect this bug?
Comment 47 Sebastian Trueg 2007-02-14 11:32:41 UTC
> ------- Same thing for me: with the new patch (id=19676) data verification
> never ends... I would ask: the output done with the patch id=19645 isn't
> suffucient to inspect this bug?


I actually hoped the last patch would fix the problem. I was wrong. Could you 
please provide the output from the last run (the one that never stopped). You 
can find it in ~/.kde/share/apps/k3b/lastlog.log.
Thanks a lot and sorry for the workload. :)
Comment 48 Francesco Locunto 2007-02-14 11:52:24 UTC
Created attachment 19681 [details]
k3b lastlog

No problem :)
Comment 49 Sebastian Trueg 2007-02-14 13:49:08 UTC
Created attachment 19683 [details]
Yet another attempt for a fix

This patch contains two things:
1. A little change in the code that hopefully fixes the verification issue.
2. If not it adds additional debugging output for further bug hunting.

Thanks a lot, guys.
Comment 50 Klaus Goebke 2007-02-14 18:22:18 UTC
I'll have a go too, when I am at home later.
Francesco proposed to me to use DVD-RW :)
I mentioned ealier, that with my hard and software DVD-RW normally seem to verify without problems. Only disks DVD+/-R together burning speed of 8x typically show the effect and nearly always then.
 
Comment 51 Klaus Goebke 2007-02-14 19:53:19 UTC
Hi Sebastian,
cross fingers - positive news - 1st result on patch-4 (19683)
I will post the protocol as well.
1. project incl. verify completed normally with "ta-ta-ta" :)
2. I will try to setup one or two new video projects today. As mentioned: normally almost each verify on DVD with speed 8x failed.
3. Further comment: verifying DVD always mentions track-1, even if there are also track-2 ore more. Would be an issue, if really only track-1 is verified. Maybe change the output to "verifying ..." ;-)
Comment 52 Klaus Goebke 2007-02-14 19:57:31 UTC
Created attachment 19692 [details]
k3b protocol - patch-4

see my last comment - next time win the same posting ;-)
Comment 53 Sebastian Trueg 2007-02-14 20:12:27 UTC
> 1. project incl. verify completed normally with "ta-ta-ta" :)


yes!

> 3. Further
> comment: verifying DVD always mentions track-1, even if there are also
> track-2 ore more. Would be an issue, if really only track-1 is verified.
> Maybe change the output to "verifying ..." ;-)


Are you talking about Video DVD titles or multisession DVDs. Because the 
tracks are the tracks on the DVD: each session creates a new track. Maybe it 
is a little too technical for the GUI... It went in there because I use the 
term track everywhere else, most noticeable when copying CDs: Audio CDs have 
multiple tracks, and so have multisession CDs. I will try to improve that 
post 1.0.
Comment 54 Klaus Goebke 2007-02-14 21:41:10 UTC
just finished another video DVD with ta-ta :)

t your question:
yes, in DVD authoring programs each (lets say) movie is called a "track"
On a DVD you can see VTS_01_1, VTS_01_2 etc for "track-1"; maybe followed by VTS_2_1 ..... for track-2; etc. Normally in menues you can select atrack and within the track segmentation in logical chapters.
Together with multisession data discs, I was familiar with "sessions", which might be segmented in tracks on the discs.
Only wanted to say that for video DVD's users may take track for a movie, whereas multisession is not common there. 
Maybe you tweak the output to "verifying disk..." for video DVDs and think about further improvement post 5.0 :))
Comment 55 Sebastian Trueg 2007-02-14 22:10:57 UTC
> just finished another video DVD with ta-ta :)


:)

> t your question:
> yes, in DVD authoring programs each (lets say) movie is called a "track"


don't you mean "title"?

> On a DVD you can see VTS_01_1, VTS_01_2 etc for "track-1"; maybe followed
> by VTS_2_1 ..... for track-2; etc. Normally in menues you can select atrack
> and within the track segmentation in logical chapters. Together with
> multisession data discs, I was familiar with "sessions", which might be
> segmented in tracks on the discs. Only wanted to say that for video DVD's
> users may take track for a movie, whereas multisession is not common there.
> Maybe you tweak the output to "verifying disk..." for video DVDs and think
> about further improvement post 5.0 :))


I cannot change strings anymore pre-1.0. So it has to wait...

Well, this one is fixed then, right?
Comment 56 Klaus Goebke 2007-02-15 00:14:12 UTC
don't know; it may depend on the SW. I used TMPGEnc Author. They call it Main menu > track menu > chapters
don't worry about the string in 1.0. It was just a comment regarding my "trained" terminology. Whenever you have a chance, you may want to rename it ...
I once succeded with 1.0 rc3 in a positive verify out of several burned disks, but never 2 disks one after the other with good verify. I will do another one maybe tonight - tomorrow is not possible.
But I would say it is very likely that you have fixed it. 

Have a handshake really and thanks from me. 
And also thanks to Francesco, who gave me 2 times the right trigger how to continue.

rgds  Klaus
Comment 57 Klaus Goebke 2007-02-15 01:37:32 UTC
3rd disk burned now with positive verify - I have nit crosschecked; the was never a difference in recent years.
however, when I read the protocol (from #52), it says:
First written md5 sum: b4ffa52527ece2e820159cc92620ba43
First read md5 sum: 0a20b47754d94972c642e6d5599bd49d

The 2 sums are different with all 3 disks.
I suppose, you are not comparing these 2 values and output the message: "all ok" ? ;)
Comment 58 Sebastian Trueg 2007-02-15 09:19:53 UTC
those two sums can be ignored. they are not used. they are just part of the additional debugging output and are calculated wrong.
Comment 59 Sebastian Trueg 2007-02-15 09:23:03 UTC
SVN commit 633751 by trueg:

* Added more debugging output for better bug hunting
* Fixed Video DVD project size calculation
* Let the MD5 job read all the data and finish gracefully
  instead of stopping it once the verification job "thinks"
  all data is processed.

BUG: 139084, 139391


 M  +26 -5     jobs/k3bdatatrackreader.cpp  
 M  +8 -3      jobs/k3bverificationjob.cpp  
 M  +9 -1      projects/datacd/k3bisoimager.cpp  
 M  +15 -2     projects/videodvd/k3bvideodvdimager.cpp  
 M  +3 -0      projects/videodvd/k3bvideodvdimager.h  
 M  +20 -4     tools/k3bactivepipe.cpp  
 M  +10 -0     tools/k3bactivepipe.h  
 M  +3 -0      tools/k3bmd5job.cpp  


--- trunk/extragear/multimedia/k3b/libk3b/jobs/k3bdatatrackreader.cpp #633750:633751
@@ -184,10 +184,13 @@
   }
 
   emitInfoMessage( i18n("Reading with sector size %1.").arg(m_usedSectorSize), K3bJob::INFO );
-  kdDebug() << "(K3bDataTrackReader::WorkThread) reading sectors " 
-	    << m_firstSector.lba() << " to " << m_lastSector.lba() 
-	    << " (" << (m_lastSector.lba() - m_firstSector.lba() + 1) 
-	    << ") with sector size: " << m_usedSectorSize << endl;
+  emitDebuggingOutput( "K3bDataTrackReader", 
+		       QString("reading sectors %1 to %2 with sector size %3. Length: %4 sectors, %5 bytes.")
+		       .arg( m_firstSector.lba() )
+		       .arg( m_lastSector.lba() )
+		       .arg( m_usedSectorSize )
+		       .arg( m_lastSector.lba() - m_firstSector.lba() + 1 )
+		       .arg( Q_UINT64(m_usedSectorSize) * (Q_UINT64)(m_lastSector.lba() - m_firstSector.lba() + 1) ) );
 
   QFile file;
   if( m_fd == -1 ) {
@@ -236,9 +239,11 @@
   }
 
   kdDebug() << "(K3bDataTrackReader) using buffer size of " << s_bufferSizeSectors << " blocks." << endl;
+  emitDebuggingOutput( "K3bDataTrackReader", QString("using buffer size of %1 blocks.").arg( s_bufferSizeSectors ) );
 
   // 2. get it on
   K3b::Msf currentSector = m_firstSector;
+  K3b::Msf totalReadSectors;
   m_nextReadSector = 0;
   m_errorSectorCount = 0;
   bool writeError = false;
@@ -264,12 +269,17 @@
 	readSectors = maxReadSectors;
     }
 
+    totalReadSectors += readSectors;
+
     int readBytes = readSectors * m_usedSectorSize;
 
     if( m_fd != -1 ) {
       if( ::write( m_fd, reinterpret_cast<void*>(buffer), readBytes ) != readBytes ) {
 	kdDebug() << "(K3bDataTrackReader::WorkThread) error while writing to fd " << m_fd 
 		  << " current sector: " << (currentSector.lba()-m_firstSector.lba()) << endl;
+	emitDebuggingOutput( "K3bDataTrackReader", 
+			     QString("Error while writing to fd %1. Current sector is %2.")
+			     .arg(m_fd).arg(currentSector.lba()-m_firstSector.lba()) );
 	writeError = true;
 	break;
       }
@@ -278,6 +288,9 @@
       if( file.writeBlock( reinterpret_cast<char*>(buffer), readBytes ) != readBytes ) {
 	kdDebug() << "(K3bDataTrackReader::WorkThread) error while writing to file " << m_imagePath
 		  << " current sector: " << (currentSector.lba()-m_firstSector.lba()) << endl;
+	emitDebuggingOutput( "K3bDataTrackReader", 
+			     QString("Error while writing to file %1. Current sector is %2.")
+			     .arg(m_imagePath).arg(currentSector.lba()-m_firstSector.lba()) );
 	writeError = true;
 	break;
       }
@@ -316,6 +329,11 @@
   m_device->close();
   delete [] buffer;
 
+  emitDebuggingOutput( "K3bDataTrackReader", 
+		       QString("Read a total of %1 sectors (%2 bytes)")
+		       .arg(totalReadSectors.lba())
+		       .arg((Q_UINT64)totalReadSectors.lba()*(Q_UINT64)m_usedSectorSize) );
+
   if( m_canceled )
     emitCanceled();
 
@@ -368,7 +386,7 @@
 // here we read every single sector for itself to find the troubleing ones
 bool K3bDataTrackReader::WorkThread::retryRead( unsigned char* buffer, unsigned long startSector, unsigned int len )
 {
-
+  emitDebuggingOutput( "K3bDataTrackReader", QString( "Problem while reading. Retrying from sector %1.").arg(startSector) );
   emitInfoMessage( i18n("Problem while reading. Retrying from sector %1.").arg(startSector), K3bJob::WARNING );
 
   int sectorsRead = -1;
@@ -387,12 +405,15 @@
     if( !success ) {
       if( m_ignoreReadErrors ) {
 	emitInfoMessage( i18n("Ignoring read error in sector %1.").arg(sector), K3bJob::ERROR );
+	emitDebuggingOutput( "K3bDataTrackReader", QString( "Ignoring read error in sector %1.").arg(sector) );
+
 	++m_errorSectorCount;
 	//	  ::memset( &buffer[i], 0, 1 );
 	success = true;
       }
       else {
 	emitInfoMessage( i18n("Error while reading sector %1.").arg(sector), K3bJob::ERROR );
+	emitDebuggingOutput( "K3bDataTrackReader", QString( "Read error in sector %1.").arg(sector) );
 	break;
       }
     }
--- trunk/extragear/multimedia/k3b/libk3b/jobs/k3bverificationjob.cpp #633750:633751
@@ -95,6 +95,8 @@
   d->md5Job = new K3bMd5Job( this );
   connect( d->md5Job, SIGNAL(infoMessage(const QString&, int)), this, SIGNAL(infoMessage(const QString&, int)) );
   connect( d->md5Job, SIGNAL(finished(bool)), this, SLOT(slotMd5JobFinished(bool)) );
+  connect( d->md5Job, SIGNAL(debuggingOutput(const QString&, const QString&)), 
+	   this, SIGNAL(debuggingOutput(const QString&, const QString&)) );
 }
 
 
@@ -255,10 +257,10 @@
       d->dataTrackReader->setSectorRange( d->toc[d->tracks[trackIndex].trackNumber-1].firstSector(),
 					  d->toc[d->tracks[trackIndex].trackNumber-1].firstSector() + d->currentTrackSize -1 );
     
+    d->md5Job->setMaxReadSize( d->currentTrackSize.mode1Bytes() );
+
     d->dataTrackReader->writeToFd( d->pipe.in() );
     d->dataTrackReader->start();
-
-    d->md5Job->setMaxReadSize( d->currentTrackSize.mode1Bytes() );
   }
   else {
     // FIXME: handle audio tracks
@@ -310,7 +312,10 @@
     d->md5Job->cancel();
   else {
     d->alreadyReadSectors += trackLength( d->currentTrackIndex );
-    d->md5Job->stop();
+
+    // close the pipe and let the md5 job finish gracefully
+    d->pipe.closeIn();
+    //    d->md5Job->stop();
   }
 }
 
--- trunk/extragear/multimedia/k3b/libk3b/projects/datacd/k3bisoimager.cpp #633750:633751
@@ -163,6 +163,10 @@
 
   d->pipe->close();
 
+  emit debuggingOutput( "K3bIsoImager", 
+			QString("Pipe throughput: %1 bytes read, %2 bytes written.")
+			.arg(d->pipe->bytesRead()).arg(d->pipe->bytesWritten()) );
+
   if( d->imageFile.isOpen() ) {
     d->imageFile.close();
 
@@ -321,8 +325,8 @@
     s += *it + " ";
   }
   kdDebug() << s << endl << flush;
+  emit debuggingOutput("mkisofs calculate size command:", s);
 
-
   // since output changed during mkisofs version changes we grab both
   // stdout and stderr
 
@@ -404,6 +408,10 @@
       m_mkisofsPrintSizeResult = m_collectedMkisofsPrintSizeStderr.mid( pos+33 ).toInt( &success );
   }
 
+  emit debuggingOutput( "K3bIsoImager", 
+			QString("mkisofs print size result: %1 (%2 bytes)")
+			.arg(m_mkisofsPrintSizeResult)
+			.arg(Q_UINT64(m_mkisofsPrintSizeResult)*2048ULL) );
 
   cleanup();
 
--- trunk/extragear/multimedia/k3b/libk3b/projects/videodvd/k3bvideodvdimager.cpp #633750:633751
@@ -58,6 +58,20 @@
 
 void K3bVideoDvdImager::start()
 {
+  fixVideoDVDSettings();
+  K3bIsoImager::start();
+}
+
+
+void K3bVideoDvdImager::init()
+{
+  fixVideoDVDSettings();
+  K3bIsoImager::init();
+}
+
+
+void K3bVideoDvdImager::fixVideoDVDSettings()
+{
   // Video DVD defaults, we cannot set these in K3bVideoDvdDoc since they
   // will be overwritten in the burn dialog unless we create some K3bVideoDVDIsoOptions
   // class with different defaults. But since the whole Video DVD project is a hack we
@@ -70,13 +84,12 @@
   o.setCreateRockRidge(false); 
   o.setCreateUdf(true); 
   d->doc->setIsoOptions( o ); 
-
-  K3bIsoImager::start();
 }
 
 
 void K3bVideoDvdImager::calculateSize()
 {
+  fixVideoDVDSettings();
   K3bIsoImager::calculateSize();
 }
 
--- trunk/extragear/multimedia/k3b/libk3b/projects/videodvd/k3bvideodvdimager.h #633750:633751
@@ -39,6 +39,7 @@
 
  public slots:
   virtual void start();
+  virtual void init();
   virtual void calculateSize();
 
  protected:
@@ -51,6 +52,8 @@
   virtual void slotReceivedStderr( const QString& );
 
  private:
+  void fixVideoDVDSettings();
+
   class Private;
   Private* d;
 };
--- trunk/extragear/multimedia/k3b/libk3b/tools/k3bactivepipe.cpp #633750:633751
@@ -40,17 +40,20 @@
 
   void run() {
     kdDebug() << "(K3bActivePipe) started thread." << endl;
+    bytesRead = bytesWritten = 0;
     buffer.resize( 10*2048 );
     ssize_t r = 0;
-    ssize_t total = 0;
     while( ( r = m_pipe->read( buffer.data(), buffer.size() ) ) > 0 ) {
 
+      bytesRead += r;
+
       // write it out
       ssize_t w = 0;
       ssize_t ww = 0;
       while( w < r ) {
 	if( ( ww = m_pipe->write( buffer.data()+w, r-w ) ) > 0 ) {
 	  w += ww;
+	  bytesWritten += ww;
 	}
 	else {
 	  kdDebug() << "(K3bActivePipe) write failed." << endl;
@@ -58,10 +61,8 @@
 	  return;
 	}
       }
-
-      total += r;
     }
-    kdDebug() << "(K3bActivePipe) thread done: " << r << " (total bytes: " << total << ")" << endl;
+    kdDebug() << "(K3bActivePipe) thread done: " << r << " (total bytes read/written: " << bytesRead << "/" << bytesWritten << ")" << endl;
     close( closeWhenDone );
   }
 
@@ -115,6 +116,9 @@
   bool closeFdToWriteTo;
 
   QByteArray buffer;
+
+  Q_UINT64 bytesRead;
+  Q_UINT64 bytesWritten;
 };
 
 
@@ -237,3 +241,15 @@
     return false;
   return true;
 }
+
+
+Q_UINT64 K3bActivePipe::bytesRead() const
+{
+  return d->bytesRead;
+}
+
+
+Q_UINT64 K3bActivePipe::bytesWritten() const
+{
+  return d->bytesWritten;
+}
--- trunk/extragear/multimedia/k3b/libk3b/tools/k3bactivepipe.h #633750:633751
@@ -99,6 +99,16 @@
    */
   int out() const;
 
+  /**
+   * The number of bytes that have been read.
+   */
+  Q_UINT64 bytesRead() const;
+
+  /**
+   * The number of bytes that have been written.
+   */
+  Q_UINT64 bytesWritten() const;
+
  protected:
   /**
    * Reads the data from the source.
--- trunk/extragear/multimedia/k3b/libk3b/tools/k3bmd5job.cpp #633750:633751
@@ -204,6 +204,7 @@
 
     if( readSize <= 0 ) {
       //      kdDebug() << "(K3bMd5Job) reached max size of " << d->maxSize << ". Stopping." << endl;
+      emit debuggingOutput( "K3bMd5Job", QString("Reached max read of %1. Stopping after %2 bytes.").arg(d->maxSize).arg(d->readData) );
       stopAll();
       emit percent( 100 );
       jobFinished(true);
@@ -257,6 +258,7 @@
       }
       else if( read == 0 ) {
 	//	kdDebug() << "(K3bMd5Job) read all data. Total size: " << d->readData << ". Stopping." << endl;
+	emit debuggingOutput( "K3bMd5Job", QString("All data read. Stopping after %1 bytes.").arg(d->readData) );
 	stopAll();
 	emit percent( 100 );
 	jobFinished(true);
@@ -301,6 +303,7 @@
 
 void K3bMd5Job::stop()
 {
+  emit debuggingOutput( "K3bMd5Job", QString("Stopped manually after %1 bytes.").arg(d->readData) );
   stopAll();
   jobFinished( true );
 }
Comment 60 Klaus Goebke 2007-02-15 17:59:57 UTC
question:
how do I apply this SVN: like a patch?
I there something new after the path from #41 (19676) ?
Comment 61 Sebastian Trueg 2007-02-15 18:58:45 UTC
> how do I apply this SVN: like a patch?
> I there something new after the path from #41 (19676) ?


just wait a little. rc7 will be out soon. And that will be the last.
Comment 62 Francesco Locunto 2007-02-15 19:31:24 UTC
Ok, I've tried with 12 DVD Data project, all of those finished succesfully :)
I think this time the verification bug is really fixed.
In case of future problems, i'll report ;)