- Reads a contiguous set of sectors one at a time off of a CD and saves them to a temporary file
- Re-reads the same set of sectors and saves them to a different file
- Compares the two files sector by sector (2352 bytes at a time)
- Writes matching sectors to a third file, and zeroes out non-matching sectors
- Prints out any differences it finds
This is the beginnings of Legg's method outlined in this thread.
This was more of a proof of concept than anything. And here is the interesting part- I am unable (in my short testing cycle) to get different read results! It makes no sense to me. First I tried ripping just a single track a few times. When this failed to cause any problems, I ripped a ton of sectors (207943 to be exact). I got this:
CODE
Using cdrom /dev/rdisk2
Ripping sectors 0 to 207942 (207943 total)
Performing first read
Performing second read
Comparing two reads
Ripping sectors 0 to 207942 (207943 total)
Performing first read
Performing second read
Comparing two reads
Maybe I need to try with some old scratched-up CDs, but nonetheless I was surprised. I don't quite see how not even one byte could be different in two files this large that were read off a cd using ioctl().
CODE
-rw------- 1 me wheel 489081936 Mar 22 15:32 riposx2GhmbA.rip
-rw------- 1 me wheel 489081936 Mar 22 15:28 riposxQrOeHx.rip
-rw------- 1 me wheel 489081936 Mar 22 15:28 riposxQrOeHx.rip
I'll be happy to share the code if anyone wants to take a look at it.
Would reading the sectors one at a time cause any different result than reading a larger chunk? I imagine that, regardless of the read size, the drive will fill its buffer in anticipation of further reads.