Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrectly fetches track length with certain offsets #14

Open
ferk6a opened this issue Jul 5, 2018 · 57 comments
Open

Incorrectly fetches track length with certain offsets #14

ferk6a opened this issue Jul 5, 2018 · 57 comments

Comments

@ferk6a
Copy link

ferk6a commented Jul 5, 2018

I've seen a number of people running into the same issue when using whopper (whipper-team/whipper#234), and one user going as far as just removing errors checks in the source code to force cd-paranoia to continue working (whipper-team/whipper#234 (comment)).

My hardware is HL-DT-ST GH22NS50, and in the AccurateRip database, it is expected that its read offset is +667. However, when using that number with cd-paranoia, it stops saying that the time/sector goes beyond end of my specified track:

$ cd-paranoia --stderr-progress --sample-offset=667 --force-cdrom-device /dev/sr0 1[00:00:00.00]-1[00:03:13.44] /tmp/tmpoEuyVd.track01.offset667.whipper.wav
Sending all callback output to stderr for wrapper script
cdparanoia III release 10.2 libcdio 2.0.0 x86_64-pc-linux-gnu
(C) 2001 Monty <monty@xiph.org> and Xiphophorus
(C) 2004, 2005, 2008 Rocky Bernstein <rocky@gnu.org>
(C) 2014 Robert Kausch <robert.kausch@freac.org>

Report bugs to bug-libcdio@gnu.org

Time/sector offset goes beyond end of specified track.

However, Xiph's cdparanoia works ok:

$ cdparanoia --stderr-progress --sample-offset=667 --force-cdrom-device /dev/sr0 1[00:00:00.00]-1[00:03:13.44] /tmp/tmpoEuyVd.track01.offset667.whipper.wav
Sending all callbacks to stderr for wrapper script
cdparanoia III release 10.2 (September 11, 2008)

Ripping from sector       1 (track  1 [0:00.00])
          to sector   14520 (track  1 [3:13.44])

outputting to /tmp/tmpoEuyVd.track01.offset667.whipper.wav

##: 0 [read] @ 25872
 (== PROGRESS == [>                             | ...... 00 ] == :^D . ==)   ##: 0 [read] @ 57624
 (== PROGRESS == [>                             | ...... 00 ] == :^D o ==)   ##: 0 [read] @ 89376
 (== PROGRESS == [>                             | ...... 00 ] == :^D 0 ==)   ##: 0 [read] @ 121128
 (== PROGRESS == [>                             | ...... 00 ] == :^D O ==)   ##: 0 [read] @ 152880
 (== PROGRESS == [>                             | ...... 00 ] == :^D 0 ==)   ##: 0 [read] @ 184632
##: 0 [read] @ 216384
 (== PROGRESS == [>                             | ...... 00 ] == :^D o ==)   ##: 0 [read] @ 248136
 (== PROGRESS == [>                             | ...... 00 ] == :^D . ==)   ##: 0 [read] @ 279888
 (== PROGRESS == [>                             | ...... 00 ] == :^D   ==)   ##: 0 [read] @ 311640
 (== PROGRESS == [>                             | ...... 00 ] == :^D . ==)   ##: 0 [read] @ 343392
##: 0 [read] @ 375144
##: 0 [read] @ 406896
...

And following the advice to leave out the time argument to cd-paranoia to guess, I end up with a very weird time signature indeed (but the sector number does match and the track is correctly ripped):

$ cd-paranoia --stderr-progress --sample-offset=667 --force-cdrom-device /dev/sr0 1 /tmp/tmpoEuyVd.track01.offset667.whipper.wav
Sending all callback output to stderr for wrapper script
cdparanoia III release 10.2 libcdio 2.0.0 x86_64-pc-linux-gnu
(C) 2001 Monty <monty@xiph.org> and Xiphophorus
(C) 2004, 2005, 2008 Rocky Bernstein <rocky@gnu.org>
(C) 2014 Robert Kausch <robert.kausch@freac.org>

Report bugs to bug-libcdio@gnu.org

Ripping from sector       1 (track  1 [0:00.00])
          to sector   14520 (track  2 [0:00.-1])

outputting to /tmp/tmpoEuyVd.track01.offset667.whipper.wav

##: 0 [read] @ 21168
 (== PROGRESS == [>                             | ...... 00 ] == :^D . ==)   ##: 0 [read] @ 50568
 (== PROGRESS == [>                             | ...... 00 ] == :^D o ==)   ##: 0 [read] @ 79968
 (== PROGRESS == [>                             | ...... 00 ] == :^D 0 ==)   ##: 0 [read] @ 109368
##: 0 [read] @ 138768
 (== PROGRESS == [>                             | ...... 00 ] == :^D O ==)   ##: 0 [read] @ 168168
 (== PROGRESS == [>                             | ...... 00 ] == :^D 0 ==)   ##: 0 [read] @ 197568
 (== PROGRESS == [>                             | ...... 00 ] == :^D o ==)   ##: 0 [read] @ 226968
 (== PROGRESS == [>                             | ...... 00 ] == :^D . ==)   ##: 0 [read] @ 256368
...
@rocky
Copy link
Collaborator

rocky commented Jul 5, 2018

I'm not going to have time to look at this. Perhaps @enzo1982 @eshattow or someone else does.

If cdparanoa works a wild guess is that one of the options that was added more recently broke this (although it fixed whatever else it was addressing). So you could try with one of the older releases or better use git bisect to find the problem.

@ferk6a
Copy link
Author

ferk6a commented Jul 6, 2018

So, I tried git bisecting for a bit, but then I thought that I should've just started from the earliest "compilable" commit, and I did, this is the earliest I got it to compile:

$ git checkout cf815f0
$ autoreconf -i && ./configure && make
$ ./src/cd-paranoia --stderr-progress --sample-offset=667 --force-cdrom-device /dev/sr0 1 /tmp/tmpnr8qzc.track01.offset667.whipper.wav
Sending all callback output to stderr for wrapper script
cdparanoia III release 9.8 libcdio 2.0.0 x86_64-pc-linux-gnu
(C) 2001 Monty <monty@xiph.org> and Xiphophorus
(C) 2004, 2005, 2008 Rocky Bernstein <rocky@gnu.org>

Report bugs to bug-libcdio@gnu.org

Ripping from sector       1 (track  1 [0:00.00])
          to sector   20654 (track  2 [0:00.-1])

outputting to /tmp/tmpnr8qzc.track01.offset667.whipper.wav

##: 0 [read] @ 21168
 (== PROGRESS == [>                             | ...... 00 ] == :^D . ==)   ##: 0 [read] @ 50568
 (== PROGRESS == [>                             | ...... 00 ] == :^D o ==)   ##: 0 [read] @ 79968
 (== PROGRESS == [>                             | ...... 00 ] == :^D 0 ==)   ##: 0 [read] @ 109368
##: 0 [read] @ 138768
 (== PROGRESS == [>                             | ...... 00 ] == :^D O ==)   ^C

And the same -1 nonsense appears (the sector number is different because I tried out another disk).

But yes, this still works on Xiph's:

$ cdparanoia --stderr-progress --sample-offset=667 --force-cdrom-device /dev/sr0 1 /tmp/tmpnr8qzc.track01.offset667.whipper.wavSending all callbacks to stderr for wrapper script
cdparanoia III release 10.2 (September 11, 2008)

Ripping from sector       1 (track  1 [0:00.00])
          to sector   20654 (track  1 [4:35.28])

outputting to /tmp/tmpnr8qzc.track01.offset667.whipper.wav

##: 0 [read] @ 25872
 (== PROGRESS == [>                             | ...... 00 ] == :^D . ==)   ##: 0 [read] @ 57624
 (== PROGRESS == [>                             | ...... 00 ] == :^D o ==)   ##: 0 [read] @ 89376
 (== PROGRESS == [>                             | ...... 00 ] == :^D 0 ==)   ##: 0 [read] @ 121128
 (== PROGRESS == [>                             | ...... 00 ] == :^D O ==)   ##: 0 [read] @ 152880
 (== PROGRESS == [>                             | ...... 00 ] == :^D 0 ==)   ##: 0 [read] @ 184632
##: 0 [read] @ 216384
 (== PROGRESS == [>                             | ...... 00 ] == :^D o ==)   ##: 0 [read] @ 248136
 (== PROGRESS == [>                             | ...... 00 ] == :^D . ==)   ^C

@rocky
Copy link
Collaborator

rocky commented Jul 6, 2018

Ok - this is useful information. Notice that in the earlier libcdio version you are not getting the message "Time/sector offset goes beyond end of specified track."

I'm not happy about the fact that the error message doesn't indicate what the time/sector offset is nor where the end of the specified track is, but I guess we'll work with that for now.

Rethinking things more carefully, I kind of see how this might happen.

cdparanoia is Linux specific in its I/O while libcdio isn't. So probably at the I/O level libcdio in the earlier version we are getting different results. In the later libcdio version it probably correctly says that the sample offset is not valid and then refuses to read it.

If you give a different offset that libcdio thinks is valid does this work?

Fixing this may be difficult if the problem is drive specific.

@ferk6a
Copy link
Author

ferk6a commented Jul 6, 2018

Actually, I'm not getting Time/sector offset goes beyond end of specified track because I didn't include the case with 1[00:00:00.00]-1[00:03:13.44], but it also does that in the older version.

Regarding the offset, yes, giving no offset or some other (specific) offsets does work, the program isn't completely broken in this regard. Just that when giving this particular offset (which happens to be the correct one) it breaks and so does some other ones, which I will need to run more lengthy tests to enumerate.

But yea, it does seem to be a bit "driver specific", although on the other thread several different models were affected, but as far as I see, all of them work with a big offset such as this one (+667).

@rocky
Copy link
Collaborator

rocky commented Jul 6, 2018

Ok, thanks. If you are up to it, would you change that error messge to include what it expected and what was seen instead? That too might point to clues.

@ferk6a
Copy link
Author

ferk6a commented Jul 6, 2018

Yep, I changed it. An offset that works:

$ ./cd-paranoia --stderr-progress --sample-offset 21 --force-cdrom-device /dev/sr0 1[00:00:00.00]-1[00:03:13.44] /tmp/tmpoEuyVd.track01.offset667.whipper.wav
Sending all callback output to stderr for wrapper script
cdparanoia III release 10.2 libcdio 2.0.0 x86_64-pc-linux-gnu
(C) 2001 Monty <monty@xiph.org> and Xiphophorus
(C) 2004, 2005, 2008 Rocky Bernstein <rocky@gnu.org>
(C) 2014 Robert Kausch <robert.kausch@freac.org>

Report bugs to bug-libcdio@gnu.org

d == -428728400
ret == 0
cdda_sector_gettrack(d, ret) == 1
i_track == 1
d == -428728400
ret == 14519
cdda_sector_gettrack(d, ret) == 1
i_track == 1
Ripping from sector       0 (track  1 [0:00.00])
          to sector   14519 (track  1 [3:13.44])

outputting to /tmp/tmpoEuyVd.track01.offset667.whipper.wav

And one that doesn't:

$ ./cd-paranoia --stderr-progress --sample-offset 667 --force-cdrom-device /dev/sr0 1[00:00:00.00]-1[00:03:13.44] /tmp/tmpoEuyVd.track01.offset667.whipper.wav
Sending all callback output to stderr for wrapper script
cdparanoia III release 10.2 libcdio 2.0.0 x86_64-pc-linux-gnu
(C) 2001 Monty <monty@xiph.org> and Xiphophorus
(C) 2004, 2005, 2008 Rocky Bernstein <rocky@gnu.org>
(C) 2014 Robert Kausch <robert.kausch@freac.org>

Report bugs to bug-libcdio@gnu.org

d == -1684971600
ret == 1
cdda_sector_gettrack(d, ret) == 1
i_track == 1
d == -1684971600
ret == 14520
cdda_sector_gettrack(d, ret) == 2
i_track == 1
Time/sector offset goes beyond end of specified track.

These lines added:

  if (minutes != -1) ret += minutes*CDIO_CD_FRAMES_PER_MIN;
  if (hours   != -1) ret += hours  *60*CDIO_CD_FRAMES_PER_MIN;

+ report("d == %d", d);
+ report("ret == %d", ret);
+ report("cdda_sector_gettrack(d, ret) == %d", cdda_sector_gettrack(d, ret));
+ report("i_track == %d", i_track);

  /* We don't want to outside of the track; if it's relative, that's OK... */
  if( i_track != CDIO_INVALID_TRACK ){
    if (cdda_sector_gettrack(d,ret) != i_track) {
      report("Time/sector offset goes beyond end of specified track.");
      exit(1);
    }
  }

@JoeLametta
Copy link

@fer22f Hi, what happens if you repeat the test with the following offsets? (587, 588, 589)

A frame/sector in a CD-DA is made of 588 pairs of left and right samples. The error may be related to this (arbitrary guess), in that case those would be the expected results:

  • 587 (success)
  • 588 (error)
  • 589 (error)

Cheers,
Joe

@ferk6a
Copy link
Author

ferk6a commented Sep 5, 2018

@JoeLametta Just tried it out, it works exactly as you described.

Baseline: ./cd-paranoia --stderr-progress --sample-offset {offset} --force-cdrom-device /dev/sr0 1[00:00:00.00]-1[00:03:13.44] /tmp/tmpoEuyVd.track01.offset667.whipper.wav
CD: Gorillaz - The Singles Collection 2001–2011 (the first track length is relevant to the discussion, switching CDs leads to the same error when specifying the correct track length)

  • 587 (success)
d == -1442922576
ret == 0
cdda_sector_gettrack(d, ret) == 1
i_track == 1
d == -1442922576
ret == 14519
cdda_sector_gettrack(d, ret) == 1
i_track == 1
Ripping from sector       0 (track  1 [0:00.00])
          to sector   14519 (track  1 [3:13.44])
  • 588 (error)
d == 508481456
ret == 1
cdda_sector_gettrack(d, ret) == 1
i_track == 1
d == 508481456
ret == 14520
cdda_sector_gettrack(d, ret) == 2
i_track == 1
Time/sector offset goes beyond end of specified track.
  • 589 (error)
d == -141733968
ret == 1
cdda_sector_gettrack(d, ret) == 1
i_track == 1
d == -141733968
ret == 14520
cdda_sector_gettrack(d, ret) == 2
i_track == 1
Time/sector offset goes beyond end of specified track.

@rocky
Copy link
Collaborator

rocky commented Sep 5, 2018

Ok. I'm lost. What does this tell us - that the two bugs are the same? Does this suggest how to fix the problem?

@JoeLametta
Copy link

Ok. I'm lost. What does this tell us - that the two bugs are the same? Does this suggest how to fix the problem?

Unfortunately I'm not sure either: maybe that the offset of the drive isn't taken into consideration when determining the track layout (sectors it spans).

@JoeLametta
Copy link

@rocky Something strange happens with CDs having 99 tracks: whipper-team/whipper#302. Same error message too.

@rocky
Copy link
Collaborator

rocky commented Oct 17, 2018

Here's a rough idea of what I think is going on. A CD can hold at most 99 tracks

If this jitter thing access outside of that then that can cause an error. So probably we need a test here.

I don't think I will get to this anytime soon, but I am hoping someone else will.

@klslz
Copy link

klslz commented Jun 11, 2019

Not sure if I ran into the same issue.

My Lite-On drive needs a correction of "+6" . That works fine. I then tried "-24" to cope with the 30 samples offset-issue of Accurate Rip.

Basically all tracks of a CD ended up at 140 bytes and only the last one was completed.

With the standard cdparanoia all is fine.

Do you guys think this is related somehow?

@eshattow
Copy link
Collaborator

eshattow commented Jun 11, 2019 via email

@JoeLametta
Copy link

JoeLametta commented Nov 9, 2019

@rocky @enzo1982
Hi, is there any progress/update on this issue?

@rocky
Copy link
Collaborator

rocky commented Nov 9, 2019

Not that I am aware of. Hey, this is open source so anyone can play - are you interested in investigating and fixing?

@JoeLametta
Copy link

I'm interested in investigating and fixing it (whipper relies heavily on cdparanoia) but I'm quite time starved and not particularly confident both with C programming and libcdio's codebase. To debug this I'd start comparing libcdio's implementation of cdparanoia with xiph's one (which seems unaffected by this bug): do you think this is a good idea?

@rocky
Copy link
Collaborator

rocky commented Nov 12, 2019

If you are comparing using a debugger at run-time, or adding debug output (or turning some on), it probably could be done.

Comparing the source level though may be hard because there have been a number of changes that folks wanted and cdparanoia's programming style is a bit unlike any other that I've seend except in obfiscated minimized C code contests. As a result, comparing at the source-code level there will be many inconsequential or purely style changes.

If you lead the way in debugging and bug detection, I may be able to help.

@MerlijnWajer
Copy link

MerlijnWajer commented Dec 3, 2019

If someone has a 667 drive, maybe try this patch. It makes parse_offset aware of the passed sample_offset. I have no clue if it's the right way to deal with this.

https://wizzup.org/dirlist/patches/libcdio-paranoia/0001-HACK-for-parse_offset-honour-sample_offset.patch

(Apply with git am 0001-HACK-for-parse_offset-honour-sample_offset.patch)

It's not entirely correct (587 should probably be 588), but I am interested to know if it breaks accuraterip output, or ripping of the last track on drives that support overread.

cc @JoeLametta

@rocky
Copy link
Collaborator

rocky commented Dec 3, 2019

@MerlijnWajer - Thanks for undertaking this.

You also might get help if you also mention this on the libcdio-devel mailing list https://lists.gnu.org/mailman/listinfo/libcdio-devel

@fenugrec
Copy link

fenugrec commented Dec 28, 2019

@MerlijnWajer , I tried you patch against 55e6604 , I have a +667 drive (LG GSA-H62N). Also tested mtdcr's patch (whipper-team/whipper#234 (comment))

Results: [EDITED 2019/12/30]

######### first, "reference" run with xiph cdparanoia:
$> cdparanoia  --sample-offset=667 1 asdf.wav

Ripping from sector       1 (track  1 [0:00.00])
	  to sector   21960 (track  1 [4:52.59])
... CRC: 5C9D3CA9

########### run with unpatched libcdio-paranoia
$> cd-paranoia  --sample-offset=667 1 asdf.wav

Ripping from sector       1 (track  1 [0:00.00])
	  to sector   21960 (track  2 [0:00.-1])
... CRC: 5C9D3CA9

$> cd-paranoia  --sample-offset=667 1[0:00.00]-1[4:52.59] asdf.wav

Time/sector offset goes beyond end of specified track.
(does not rip)

########### run with your patch, but 588 instead of 587
$> cd-paranoia 1 asdf.wav

Ripping from sector       1 (track  1 [0:00.00])
	  to sector   21960 (track  1 [4:52.59])
... CRC: F8E1BDC4 (mismatch due to 0 offset, that's OK)

$> cd-paranoia -O 667 1 asdf.wav

Ripping from sector       1 (track  1 [0:00.00])
	  to sector   21960 (track  2 [0:00.-1])
... CRC: 5C9D3CA9 (matches xiph_667)

$> cd-paranoia  -O 667 1[0:00.00]-1[4:52.59] asdf.wav

Ripping from sector       1 (track  1 [0:00.00])
	  to sector   21959 (track  1 [4:52.58])
... file is 2352 bytes (588*4) shorter, common contents identical

########### run with mtdcr patch
$> cd-paranoia -O 667 1 asdf.wav

Ripping from sector       1 (track  1 [0:00.00])
	  to sector   21960 (track  2 [0:00.-1])
... CRC: 5C9D3CA9 (matches xiph_667)


$> cd-paranoia  -O 667 1[0:00.00]-1[4:52.59] asdf.wav

Time/sector offset goes beyond end of specified track.
Ripping from sector       1 (track  1 [0:00.00])
	  to sector   21960 (track  2 [0:00.-1])
... CRC: 5C9D3CA9 (matches xiph_667)

@MerlijnWajer
Copy link

Thank you for trying - can you explain what exactly the behaviour is that you're seeing? It looks different to me, but maybe the new effect is the same. Does it rip the tracks? Do they have different checksums? What if you rip all the tracks with the offset?

@fenugrec
Copy link

fenugrec commented Dec 29, 2019

So in my case, I'm here because of the whipper frontend ( whipper-team/whipper#234 ) . cd-paranoia on its own seems to be able to rip the tracks (although with a few bytes different every time, but that's a seperate issue with my drive/media). But the reported bounds throw off whipper ; as I understand [EDIT : I understood wrong, this is not the case] it subtracts the two timecodes to determine the track length, so the '-1' breaks that and whipper fails to rip.

@rocky
Copy link
Collaborator

rocky commented Dec 29, 2019

@fenugrec I am okay with extending the libcdio-paranoia behavior is to something that is more helpful to whipper, if it is the case that important lost information is happening inside libcdio-paranoia (as opposed to whipper interpreting the existing data reported back in a better way).

It is kinder to existing applications to extend libcdio-paranoia than change the current behavior, unless the current behavior has a bug that is unfixable in its current state.

@fenugrec
Copy link

fenugrec commented Dec 29, 2019

Hi,
@rocky , I think the issue boils down to two things : [EDITED ! sorry]

  • if no span is given, and sample-offset >= 588, it reports span-end = -1 , but ripped data (validity and length) seems to be unaffected as far as I can tell.
  • If (sample-offset) + (specified span_end) >= (real track_end + 588), cd-paranoia will refuse to rip , "Time/sector offset goes beyond end of specified track". To (hopefully) explain this one better :
### expected bounds : [0:00.00] to [4:52.59]
cd-paranoia --sample-offset=588 1[00:00:00.00]-1[00:04:52.59] asdf.wav     => fails
cd-paranoia --sample-offset=588 1[00:00:00.00]-1[00:04:52.58] asdf.wav     => works, because I tweaked the span end.
This last one would result in an incomplete file

Whether or not current behaviour is acceptable is debatable; some arguments :

  • xiph cdparanoia reports a sane timecode, and accepts offsets >= 588
  • whipper would like to use offsets >= 588

No idea if other existing apps expect different behaviour, and that would be a valid point for your consideration. I'm really not informed enough to say more about this.
But I do have a "+667" drive and am willing to test patches. No time to get deep into the issue though, sorry...

@JoeLametta
Copy link

@TheMuso Hi, is there any progress about this issue?

@TheMuso
Copy link

TheMuso commented Sep 10, 2020 via email

@JoeLametta
Copy link

Sorry, Other things have gotten in the way since I looked into this. I will try and make some time in the next couple of weekends or so to work on the fix.

Luke

Thanks for the status update: didn't intend to put pressure on you 😉

@JoeLametta
Copy link

@TheMuso Kindly asking again for a status update, thanks!

@TheMuso
Copy link

TheMuso commented Jan 14, 2021 via email

@45054
Copy link

45054 commented May 14, 2021

Hi. I have put a small bounty on this bug: https://www.bountysource.com/issues/60536098-incorrectly-fetches-track-length-with-certain-offsets for anyone interested in solving this.

@samliddicott
Copy link

samliddicott commented May 18, 2021 via email

@seisure
Copy link

seisure commented Aug 12, 2021

I'm sorry, I mentally made a note to reply to this, and forgot. Not sure when I'll have the time to work on this. Someone is welcome to work on it if they wish.

As far as I have understood you've made already good progress. Wouldn't it make sense for others to build upon your work? Can you make your branch available?
Thank you.

@returntoreality
Copy link

I've added another $50 so it stands at $165

@45054
Copy link

45054 commented Nov 20, 2021

Although the Bountysource currently states 165$ I have to add that my bounty of 100$ has expired and was paid back after some mail exchange (the automatic process does not work apparently).

Anyone fixing the bug will still get the 100$, we will find a way. Bountysource however does not appear to be very reliable anymore (see bountysource/core#1539)

@dangpzanco
Copy link

Any update on this issue?

@rocky
Copy link
Collaborator

rocky commented Oct 7, 2022

It looks like there isn't anyone interested on working on this even for the bounty listed above. But, hey, this is open source code so anyone can dive in and fix. Hey, how about you?

@dangpzanco
Copy link

@rocky yup, I'll probably try implementing the suggestions @TheMuso gave. The problem is I only discovered this project this week (via whipper's pinned issue) and I'm not very familiar with the concept of offset on CD drives.

@fenugrec
Copy link

fenugrec commented Oct 7, 2022

Interestingly just last week I was (trying to) rip some CDs for the first time since I last posted earlier up, ran into the same issue again, and remembered this ticket. I still have that drive and could find time to try patches, but no time for any coding.

@rocky
Copy link
Collaborator

rocky commented Oct 7, 2022

I'm not very familiar with the concept of offset on CD drives.

No one is born being familiar with the concept of offset on CD drives. But as Richard Feynman has said: "What one fool can learn, so can another".

@francoisjacques
Copy link

I think the challenge here lies into understand:

  • what the exact behavior code was in former cdparanoia codebase (that works)
  • how later changes in libcdio broke it, while fixing other things
  • fix the regression while not breaking libcdio.

Perhaps if someone could come up with a C snippet that would demonstrate the incorrect output for a given set of inputs as test case, it would make the journey a little simpler. If the issue is only reproable with a physical reader, it makes the troubleshooting much more difficult...

In my professional life, I often had to do such archeological work (what did the original developer intended? Can I make the original code work with a modern compiler and use that as reference?) and incrementally study the drift in time to understand what the later changes did. Of course, it depends how much time someone is willing to invest to fix such issue.

If it was easy to fix, it'd be already fixed...

@fenugrec
Copy link

Perhaps if someone could come up with a C snippet that would demonstrate the incorrect output for a given set of inputs as test case, it would make the journey a little simpler.

How about instrumenting a few key API calls and logging arguments and return values ? Probably more useful than an strace log . Maybe 'rr' could be used as well ?

@buddyabaddon
Copy link
Contributor

I believe I have a fix for this issue #38.

If others with different drive offsets can help test (mine is +667), I'd like to hear your results.

@mdosch
Copy link

mdosch commented Feb 16, 2024

I ran whipper offset find which identified an offset of 594 for my
PHILIPS - CDRW-DVD CDD5263 which is the same as at
https://www.accuraterip.com/driveoffsets.htm.

Ripping a CD also worked successfully. 👍

@rocky
Copy link
Collaborator

rocky commented Feb 16, 2024

Looks great. It would be great to get confirmation from as many of the below as possible.

Thanks.

@buddyabaddon
Copy link
Contributor

Thanks for helping with another validation @mdosch.

Looks like things are working for drives with the following offsets:

  • +667
  • +594

If anyone has a drive with an offset less than 1 sector (<+588) or greater than 2 sectors (>+1176), I'd love to hear your results.

Also (they seem to be much rarer) if anyone has a drive with a negative offset, that would be interesting to see as well.

@aereaux
Copy link

aereaux commented Feb 17, 2024

I'm not sure what I needed to do to trigger bad behavior previously but it seems to work through all the listed tests on a disc in a drive with offset +702. I did try going through the offset find process but it seemed to get stuck on trying a negative offset. Not sure if that's because of my drive or something else.

@buddyabaddon
Copy link
Contributor

Thanks for testing @aereaux. I'm assuming you are using libcdio-paranoia via Whipper here...

As you have a drive with >1 sector sample offset, you just need to attempt to rip a disc with your +702 read_offset set in whipper.conf (or specified via the cmdline via --offset +702) to trigger bad behavior.

I suspect that your offset find attempt got stuck on a negative offset because your drive doesn't support reading into the lead-in. Pre-existing libcdio-paranoia logic (and even after my change for that matter), doesn't apply the same empty padding approach as reading into the lead-out when --force-overread is not specified.

To find your drive sample offset, I believe Whipper simply runs through multiple extraction attempts with different offsets and compares the results with the AccurateRip database. If there's a match, it attempts a few more tracks with the current offset and if they are all accurate, it considers your offset discovered.

whipper offset find --help shows the default set of offsets it attempts... did your try hang on offset -472 by chance? I see it in the list before your +702 offset.

Can you try via whipper find offset --offsets 702? You can set the environment variable WHIPPER_DEBUG=DEBUG to get extra debug information too.

In summary, libcdio-paranoia shouldn't attempt to actually read into the disc lead-in or lead-out unless --force-overread is specified. Right now that is not the case for lead-in when a negative offset is specified. This should be treated as a separate bug and I did not attempt to address this.

@aereaux
Copy link

aereaux commented Feb 17, 2024

Yeah, it was -472 where it hanged and doing whipper offset find with an explicitly +702 offset worked fine. I think I had this problem originally too, so I don't think it's related to this change.

In short my tests seemed all good for this. Thanks for doing the work on it!

@fenugrec
Copy link

Awesome, seems to work perfectly - tested on drive HL-DT-ST DVDRAM GSA-H62N .

  • whipper offset find correctly reports offset of 667 (we'll have to do something about silencing whipper's "offset > 587" warning now !
  • whipper cd rip success with confidence 10

@buddyabaddon very well done.

@rocky
Copy link
Collaborator

rocky commented Feb 18, 2024

Ok - thanks everyone for the information! I didn't want to belabor this, but I did want to get some sense of what is up.

Again @buddyabaddon - thanks. Let's merge and if there is more you can iterate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests