#1035549 reportbug: abcde-musicbrainz-tool fails for a CD with only 1 track

#1035549#5
Date:
2023-05-05 10:32:41 UTC
From:
To:
Hello,

I encountered a problem with a bit of an unusual case, a CD with only
one track. The errors I get are:

Insufficient or missing discinfo data.
[ERROR] abcde: abcde-musicbrainz-tool failed to run; ABORT

I'll attach the debug log to the bg report, but I already did some
digging and found the problem. In line 305 of abcde-musicbrainz-tool
there is what if probably a sanity check of the input data used to
calculate the discid. For my CD with only one track the tool is called
with "abcde-musicbrainz-tool --command calcid --discinfo 1 1 150 273567
0", and that sanity check is "if ($#discinfo < 5)". $#discinfo checks
the last index in the discinfo array, so that check triggers an error if
i.e. there is only one track offset given (because there is only one
track total). If I change the check "if ($#discinfo < 4)" everything
works, but maybe the check should be revised to something slightly more
sophisticated (i.e. checking if the number of offsets fits the number of
tracks and so on), but I have no idea if that is really necessary.