bugCompact Disc Input and Control Library - Bugs: bug #49090, Cd-info reports 2 sessions for...

 
 

bug #49090: Cd-info reports 2 sessions for single session mixed-mode CD

Submitter:  Johan van der Knijff <bitsgalore>
Submitted:  Wed 14 Sep 2016 04:29:43 PM UTC
   
 
Category:  utility program Severity:  5 - Average
Item Group:  cd-info Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 20 Sep 2016 11:43:11 AM UTC, comment #13: 

Sure. If you do come up with an improvement, then let others know.

This code is only as good as people are willing to make it better.

It has long exceeded my personal needs.

Rocky Bernstein <rocky>
Group administrator
Tue 20 Sep 2016 10:16:21 AM UTC, comment #12: 

Hi Rocky,

Many thanks for your help with this! I think I now have a workaround that is good enough for my specific purpose (which is identifying CD/DVD for batch ISO image extraction / audio ripping), based on parsing the output of the existing stable version. I'd like to have a more in-depth look into the code later to see if I can come up with an improvement, but this may take a while.

Cheers,

Johan

Johan van der Knijff <bitsgalore>
Sat 17 Sep 2016 10:07:58 AM UTC, comment #11: 

You are not seeing CDIO_FS_ANAL_MULTISESSION because that's bit is set in the the  code block set after the changed condition (i > 1 && num_audio == 0). See if you can come up with replacement code for lines 1288 through 1302.

You are probably in the best position to decide and understand what makes the most sense. Thanks.

Rocky Bernstein <rocky>
Group administrator
Fri 16 Sep 2016 03:06:35 PM UTC, comment #10: 

Right, as I'm able to compile cd-info now (steps mewntioned in previous response work under Cygwin as well) I'll get back to my original question about multisession CDs: I changed line 1288 in cd-info.c into

  if (i > 1 && num_audio == 0) {

However this has the unwanted effect that for 'enhanced' audio CDs are not identified as multisession discs. See before/after output below:

Before:

    CD Analysis Report
    No CD-TEXT on Disc.
    CD-Plus/Extra  
    session #2 starts at track 18, LSN: 163570, ISO 9660 blocks:      0
    ISO 9660: 0 blocks, label `'

Which is OK.

After:

    CD Analysis Report
    No CD-TEXT on Disc.
    CD-Plus/Extra  
    CD-ROM with unknown filesystem
    CD-Plus/Extra

Which is not OK.

So I wouldn't be in favour of including this change.

While at it, this caught my attention in line 755 of cd-info.c:

  if (fs & CDIO_FS_ANAL_MULTISESSION)
    need_lf += printf("Multisession, offset = %i   ", ms_offset);

Seeing this I would expect something like this in the CD Analysis Report for multisession CDs:

    Multisession, offset = 163570
   
But for some reason this missing in the output (don't really understand why).

Johan van der Knijff <bitsgalore>
Fri 16 Sep 2016 12:55:48 PM UTC, comment #9: 

Yes, I'd  figured out the libtool dependency already - actually without it the configure script doesn't even work at all (see also below). I followed your suggestions, and here's the output of the modified _cdio_generic.lo.sh script:

    ../../libtool: 1569: ../../libtool: preserve_args+= --silent: not found
    ../../libtool: 1581: ../../libtool: preserve_args+= --tag CC: not found
    ../../libtool: 1: eval: base_compile+= gcc: not found
    ../../libtool: 1: eval: base_compile+= -DHAVE_CONFIG_H: not found
    ../../libtool: 1: eval: base_compile+= -I.: not found
    ../../libtool: 1: eval: base_compile+= -I../..: not found
    ../../libtool: 1: eval: base_compile+= -I../../lib/driver: not found
    ../../libtool: 1: eval: base_compile+= -I../../include: not found
    ../../libtool: 1: eval: base_compile+= -I../../include/: not found
    ../../libtool: 1: eval: base_compile+= -g: not found
    ../../libtool: 1: eval: base_compile+= -O2: not found
    ../../libtool: 1: eval: base_compile+= -Wall: not found
    ../../libtool: 1: eval: base_compile+= -Wcast-align: not found
    ../../libtool: 1: eval: base_compile+= -Wchar-subscripts: not found
    ../../libtool: 1: eval: base_compile+= -Wdisabled-optimization: not found
    ../../libtool: 1: eval: base_compile+= -Winline: not found
    ../../libtool: 1: eval: base_compile+= -Wmissing-declarations: not found
    ../../libtool: 1: eval: base_compile+= -Wmissing-prototypes: not found
    ../../libtool: 1: eval: base_compile+= -Wnested-externs: not found
    ../../libtool: 1: eval: base_compile+= -Wno-sign-compare: not found
    ../../libtool: 1: eval: base_compile+= -Wpointer-arith: not found
    ../../libtool: 1: eval: base_compile+= -Wstrict-prototypes: not found
    ../../libtool: 1: eval: base_compile+= -Wunused: not found
    ../../libtool: 1: eval: base_compile+= -Wwrite-strings: not found
    ../../libtool: 1: eval: base_compile+= -MT: not found
    ../../libtool: 1: eval: base_compile+= _cdio_generic.lo: not found
    ../../libtool: 1: eval: base_compile+= -MD: not found
    ../../libtool: 1: eval: base_compile+= -MP: not found
    ../../libtool: 1: eval: base_compile+= -MF: not found
    ../../libtool: 1: eval: base_compile+= .deps/_cdio_generic.Tpo: not found
    ../../libtool: 1: eval: base_compile+= -c: not found
    libtool: compile: you must specify a compilation command
    libtool: compile: Try `libtool --help --mode=compile' for more information.
   
I'm using libtool 2.4.2. Maybe libcdio needs another version?

In addition to this, after some experimenting I was able to build the tool binaries on my Linux machine (even though the build process ends prematurely). Here's the full sequence of commands I used on a fresh clone (note that the libtoolize, aclocal, autoheader, automake and autonconf commands are not mentioned in the documentation but I need them anyway - see also https://bbs.archlinux.org/viewtopic.php?id=161452). Here goes:

    git clone git://git.sv.gnu.org/libcdio.git
    cd libcdio
    libtoolize --force
    aclocal
    autoheader
    automake --force-missing --add-missing
    autoconf
    sh ./configure --disable-shared --without-versioned-libs MAKE=make
    remake -x
    cd doc
    make stamp-vti
    cd ..
    remake -x

Result: exectuables for cd-drive, cd-info, cd-read, iso-info, iso-read, mmc-tool successfully built in src directory! However, things go wrong again after `mmc-tool` is built:

    ##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
      CCLD     mmc-tool
          /home/johan/libcdio/src/Makefile:613 Successfully remade target file `mmc-tool'.
          File `cd-drive.1' does not exist.
          Must remake target `cd-drive.1'.
    remake[2]: * No rule to make target `cd-drive.1', needed by `all-am'.  Stop.
    remake[2]: Leaving directory `/home/johan/libcdio/src'
    Command-line invocation:
    "remake all"
    Makefile:563: * [all-recursive] Error 1
   
    #0  all-recursive at /home/johan/libcdio/Makefile:563
    remake[1]: Leaving directory `/home/johan/libcdio'
    Command-line invocation:
    "remake all-recursive"
    Makefile:459: * [all] Error 2
   
    #0  all at /home/johan/libcdio/Makefile:459
    Command-line invocation:
    "remake -x"


Johan van der Knijff <bitsgalore>
Thu 15 Sep 2016 11:50:28 PM UTC, comment #8: 

What's disappointing here is that it looks like you can't do a single C compile without failure. I thought --disable-shared and --without-versioned-libs would eliminate libtool, but it's not doing that anymore.

Do you have libtool installed? If not, it looks like nowadays on Linux you need to have that installed.

If you want to verify that it's libtool that is messed up, then now that you have remake installed you can do this:

In the Makefile you post find the line that says

$ remake -X _cdio_generic.lo
Reading makefiles...
Updating makefiles....
-> (/src/external-vcs/savannah/libcdio/lib/driver/Makefile:578)
Makefile: Makefile.in ../../config.status
remake<0> b _cdio_generic.lo
Breakpoint 1 on target _cdio_generic.lo, mask 0x07: file .deps/_cdio_generic.Plo, line 1.
remake<1> c
Updating goal targets....
-> (/src/external-vcs/savannah/libcdio/lib/driver/.deps/_cdio_generic.Plo:1) ...
remake<3> s
.. (/src/external-vcs/savannah/libcdio/lib/driver/.deps/_cdio_generic.Plo:1)
_cdio_generic.lo
remake<4> w
File "/tmp/_cdio_generic.lo.sh" written.
remake<5> q

Now edit /tmp/_cdio_generic.lo.sh

You'll these in lines 2 and 3 something similar to:

#cd /src/external-vcs/savannah/libcdio/lib/driver
@echo "  CC      " _cdio_generic.lo;depbase=`echo _cdio_generic.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\

Take out the first character of each line so it looks like

cd ...
echo ...

And then run that script with tracing:

   bash -x /tmp/_cdio_generic.lo.sh

Rocky Bernstein <rocky>
Group administrator
Thu 15 Sep 2016 02:54:48 PM UTC, comment #7: 

Hi Rocky,

Thanks again! Running make in the doc dir seems to work (at least it doesn't result in any error messages), but if I then go back to the repo root dir and re-run make (at least I'm assuming I'm supposed to do that?), another error occurs which is related to the Makefile in /lib/driver. Remake output:

<https://gist.github.com/bitsgalore/c5d441cc7fbce813d0cd1c26b58e98bf>

And this is the Makefile under /lib/driver:

<https://gist.github.com/bitsgalore/76f4132308ebd654d168b722e78b2c3e>


Johan van der Knijff <bitsgalore>
Thu 15 Sep 2016 12:33:42 PM UTC, comment #6: 

No that's not the same error message as before. You are in a different directory building a different make target.

This problem is an oddity of building from git.

Run:

   cd doc
   make stamp-vti

I'll update autogen.sh go run these instructions in the future when I get a chance.

Rocky Bernstein <rocky>
Group administrator
Thu 15 Sep 2016 11:00:49 AM UTC, comment #5: 

So I followed your instructions:

   bash configure --disable-shared --without-versioned-libs MAKE=make
   make -n
 
This still gives me the same error as before. So next I installed & ran remake. Output here;

https://gist.github.com/bitsgalore/14ad4598d0b0064ac961b2d47ddcd5d2

(Updated Makefile at: https://gist.github.com/bitsgalore/f35c1f3793343ce8848c86a035085b32 )

Very strange ...

Johan van der Knijff <bitsgalore>
Thu 15 Sep 2016 10:43:39 AM UTC, comment #4: 

Possibly simplest thing to do here is to run with the configure options --disable-shared and --without-versioned-libs. That is

   bash configure --disable-shared --without-versioned-libs

That will disable libtool which is implicated in the error message and is otherwise generally and undesired complication.

If you are still getting make errors, what I generally do is install remake http://bashdb.sf.net/remake and run that like this:

   remake -x # whatever other make options you use

Keep a log of that output and I should be able to better understand where and possibly why something is failing.

Rocky Bernstein <rocky>
Group administrator
Thu 15 Sep 2016 10:30:53 AM UTC, comment #3: 


Thanks for getting back to this and for your suggestions.

As for the erroneous disc mode - this is something that caught my eye as well. I'm actually getting this for all discs, including audio CDs and CD-ROMs. This only happens under Windows (tried both with some Cygwin binaries I downloaded and binaries built with Mingw-64 using the script in my original message). On my Linux machine the correct disc mode is displayed (though the number of sessions for my mixed-mode CD is wrong there as well, which makes me think these two issues are unrelated).

This is also the reason I'm using the --dvd option, as cd-info won't analyse any of my CDs otherwise. Tbh I don't know if this is a bug in libcdio, a driver problem or some weird OS-related issue.

As for the sessions issue - I'd like to try out the changes you propose, but the problem is I can't get libcdio to compile! Following the instructions in README.libcdio, everything goes well up to step 2; once I run make I end up with the following error (using make -n): 

    make[3]: * No rule to make target `../../lib/driver/libcdio.la', needed by `libcdio++.la'.  Stop.

This happens both on my Linux machine and under Cygwin. Must add here that I know very little about C, so I may just be overlooking something really obvious. FWIW I uploaded my makefile here:  

https://gist.github.com/bitsgalore/f35c1f3793343ce8848c86a035085b32

Thanks,

Johan

Johan van der Knijff <bitsgalore>
Thu 15 Sep 2016 09:38:11 AM UTC, comment #2: 

Thanks for the report.  The one thing that does seem a little fishy to me is "Disc mode is listed as: DVD-ROM". Clearly the mixed mode CD's you are referring to were not DVD's. Line 678 of lib/driver/MSWindows/win32_ioctl.c http://git.savannah.gnu.org/cgit/libcdio.git/tree/lib/driver/MSWindows/win32_ioctl.c#n678 is where we basically ask MSWindows whether the disc is loaded is a DVD and that issues the MMC command GPCMD_READ_DVD_STRUCTURE in http://git.savannah.gnu.org/cgit/libcdio.git/tree/lib/driver/mmc/mmc.c#n467

So there should be no reason for you to give the --dvd option to cd-info. An experiment I suggest is to create this so that it is burned as a CD and cd-info reports this as some sort of CD dismode (like "CD-ROM Mixed").

However looking this isn't going to change that session message.

Try changing line 1288 of cd-info.c http://git.savannah.gnu.org/cgit/libcdio.git/tree/src/cd-info.c#n1288 from:

   if (i > 1) {

to:

   if (i > 1 && num_audio == 0) {

and see if that works better. If so, let me know and I will make the change.

Thanks.

Rocky Bernstein <rocky>
Group administrator
Wed 14 Sep 2016 04:35:40 PM UTC, comment #1: 

OK, second attempt, this time without html markup (can't find any way to edit my original report)...

## Libcdio version

0.93 (x86_64-w64-mingw32), built using: <https://github.com/jb-alvarado/media-autobuild_suite>

## Platform

Windows 7 (but getting the same results on my Linux Mint machine).


## Description

I'm using cd-info to extract information about the content (data/audio) and the number of sessions of a heterogeneous collection of CDs. When I used the tool on a single session mixed-mode CD (1st track data track; remaining tracks audio tracks; not a very common layout but something similar was used for some old videogame CDs from the 90s).

I used the following command:

     cd-info -C d: --no-header --no-device-info --no-cddb --dvd 

Result:


    CD location   : d:
    CD driver name: WIN32
       access mode: ioctl
   
    ________________________________
   
    Disc mode is listed as: DVD-ROM
    CD-ROM Track List (1 - 8)
      #: MSF       LSN    Type   Green? Copy?
      1: 00:02:00  000000 data   false  no
      2: 00:51:68  003743 audio  false  no    2        no
      3: 01:03:40  004615 audio  false  no    2        no
      4: 01:21:36  005961 audio  false  no    2        no
       ::
      7: 02:19:67  010342 audio  false  no    2        no
      8: 02:38:41  011741 audio  false  no    2        no
    170: 02:59:73  013348 leadout (29 MB raw, 26 MB formatted)
    ________________________________
    CD Analysis Report
    ++ WARN: CD-Text size is too small or not a multiple of pack size
    No CD-TEXT on Disc.
    mixed mode CD
    CD-ROM with ISO 9660 filesystem and joliet extension level 3
    ISO 9660: 3488 blocks, label `Data                            '
    Application: GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR (C) 1993 E.YOUNGDALE (C
    ) 1997-2006 J.PEARSON/J.SCHILLING (C) 2006-2007 CDRKIT TEAM
    Preparer   :
    Publisher  :
    System     : LINUX
    Volume     : Data
    Volume Set :
    mixed mode CD
    session #2 starts at track  2, LSN: 3743, ISO 9660 blocks:   3488
    ISO 9660: 3488 blocks, label `Data                            '

Now the problem is that cd-info reports that the disc contains 2 sessions, whereas in reality only one session exists (confirmed by checks with IsoBuster and cdrdao). This looks like a bug to me.

## Test data

I uploaded data + scripts to reproduce the problem at <https://git hub.com/KBNLresearch/cdtestcorpus>. Steps:

1.     git clone https://github.com/KBNLresearch/cdtestcorpus.git
2.     cd cdtestcorpus
3. Check CD device path in config.txt (and modify if necessary).
4. Insert empty CD-R in tray.
5.     ./audioAndDataSingleSession.sh

Johan van der Knijff <bitsgalore>
Wed 14 Sep 2016 04:29:43 PM UTC, original submission:  

<h2>Libcdio version</h2>
<p>0.93 (x86_64-w64-mingw32), built using: <a href="https://github.com/jb-alvarado/media-autobuild_suite">https://github.com/jb-alvarado/media-autobuild_suite</a></p>
<h2>Platform</h2>
<p>Windows 7 (but getting the same results on my Linux Mint machine).</p>
<h2>Description</h2>
<p>I'm using <em>cd-info</em> to extract information about the content (data/audio) and the number of sessions of a heterogeneous collection of CDs. When I used the tool on a <em>single session</em> mixed-mode CD (1st track data track; remaining tracks audio tracks; not a very common layout but something similar was used for some old videogame CDs from the 90s).</p>
<p>I used the following command:</p>
<pre><code> cd-info -C d: --no-header --no-device-info --no-cddb --dvd
</code></pre>
<p>Result:</p>
<pre><code>CD location   : d:
CD driver name: WIN32
   access mode: ioctl

________________________________

Disc mode is listed as: DVD-ROM
CD-ROM Track List (1 - 8)
  #: MSF       LSN    Type   Green? Copy?
  1: 00:02:00  000000 data   false  no
  2: 00:51:68  003743 audio  false  no    2        no
  3: 01:03:40  004615 audio  false  no    2        no
  4: 01:21:36  005961 audio  false  no    2        no
   ::
  7: 02:19:67  010342 audio  false  no    2        no
  8: 02:38:41  011741 audio  false  no    2        no
170: 02:59:73  013348 leadout (29 MB raw, 26 MB formatted)
________________________________
CD Analysis Report
++ WARN: CD-Text size is too small or not a multiple of pack size
No CD-TEXT on Disc.
mixed mode CD
CD-ROM with ISO 9660 filesystem and joliet extension level 3
ISO 9660: 3488 blocks, label `Data                            '
Application: GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR (C) 1993 E.YOUNGDALE (C
) 1997-2006 J.PEARSON/J.SCHILLING (C) 2006-2007 CDRKIT TEAM
Preparer   :
Publisher  :
System     : LINUX
Volume     : Data
Volume Set :
mixed mode CD
session #2 starts at track  2, LSN: 3743, ISO 9660 blocks:   3488
ISO 9660: 3488 blocks, label `Data                            '
</code></pre>
<p>Now the problem is that <em>cd-info</em> reports that the disc contains 2 sessions, whereas in reality only one session exists (confirmed by checks with IsoBuster and cdrdao). This looks like a bug to me.</p>
<h2>Test data</h2>
<p>I uploaded data + scripts to reproduce the problem at <a href="https://git hub.com/KBNLresearch/cdtestcorpus">https://git hub.com/KBNLresearch/cdtestcorpus</a>. Steps:</p>
<ol>
<li>git clone https://github.com/KBNLresearch/cdtestcorpus.git</li>
<li>cd cdtestcorpus</li>
<li>Check CD device path in <em>config.txt</em> (and modify if necessary).</li>
<li>Insert empty CD-R in tray.</li>
<li>./audioAndDataSingleSession.sh</li>

Johan van der Knijff <bitsgalore>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rocky (Posted a comment)
  • -email is unavailable- added by bitsgalore (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code