Bug 220868

Summary: sysutils/cdrtools: isoinfo encountered segmentation fault on test images
Product: Ports & Packages Reporter: Guangyuan Yang <ygy>
Component: Individual Port(s)Assignee: Marius Strobl <marius>
Status: Closed FIXED    
Severity: Affects Some People CC: emaste, ygy
Priority: --- Flags: bugzilla: maintainer-feedback? (marius)
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 220870    
Attachments:
Description Flags
The image that fails isoinfo
none
Patch for sysutils/cdrtools integrating official isoinfo and mkisofs fixes none

Description Guangyuan Yang freebsd_committer freebsd_triage 2017-07-19 22:20:29 UTC
Created attachment 184520 [details]
The image that fails isoinfo

isoinfo works fine on other images but fails on this particular image (from the diffoscope test suite). Can confirm that it works fine with this image on Arch Linux.


# isoinfo -l -i test1.iso
Setting input-charset to 'UTF-8' from locale.

Directory listing of /
dr-xr-xr-x   1    0    0       2048 Jun 24 2015 [     23 02] . 
dr-xr-xr-x   1    0    0       2048 Jun 24 2015 [     23 02] .. 
-r-xr-xr-x   1    0    0          0 Jun 24 2015 [     25 00] LINK.;1 
-r-xr-xr-x   1    0    0          0 Jun 24 2015 [     25 00] NULL.;1 
-r-xr-xr-x   1    0    0        446 Jun 24 2015 [     25 00] TEXT.;1 

Directory listing of (NULL POINTER)
[1]    89096 segmentation fault (core dumped)  isoinfo -l -i test1.iso
Comment 1 Guangyuan Yang freebsd_committer freebsd_triage 2017-07-20 14:50:57 UTC
I replaced `sysutils/cdrtools` (ver 3.01) with `sysutils/cdrtools-devel` (ver 3.02 alpha7) and it works just fine now. This could be a bug that appears in 3.01 but got fixed in the newest devel version. More investigation is needed.

It's interesting that since cdrtools 3.02 stays alpha, cdrtools-devel stays devel (for years, long overdue). And by default, FreeBSD comes with the older stable version.

https://sourceforge.net/projects/cdrtools/files/alpha/
http://www.freshports.org/sysutils/cdrtools-devel/
Comment 2 Marius Strobl freebsd_committer freebsd_triage 2017-07-23 15:20:09 UTC
Created attachment 184636 [details]
Patch for sysutils/cdrtools integrating official isoinfo and mkisofs fixes
Comment 3 Marius Strobl freebsd_committer freebsd_triage 2017-07-23 15:33:47 UTC
(In reply to Guangyuan (Charlie) Yang from comment #1)

Well, FreeBSD ports just mirror the upstream release policy and
sysutils/cdrtools in fact is at the current stable version 3.01.

I've noticed that an official patch was released for isoinfo and
mkisofs in cdtrools 3.01 which adds directory loop recognition in
order to prevent from an endless loops that in turn may consume
all available memory, though. Please give the patch in Bugzilla
attachment #184636 [details] a try, which integrates said fix into the
sysutils/cdrtools port. However, I can't tell whether that will
solve your problem as your test1.iso from attachment #184520 [details]
doesn't cause the isoinfo of the sock cdrtools 3.01 to segfault
here. If that patch doesn't make a difference, I'll just close
this PR, though, as this problem isn't really specific to FreeBSD
or FreeBSD ports and sysutils/py-diffoscope should just consider
using sysutils/cdrtools-devel for testing then.
Comment 4 Guangyuan Yang freebsd_committer freebsd_triage 2017-07-23 18:45:24 UTC
(In reply to Marius Strobl from comment #3)

Thanks! So the image I uploaded works fine on your system with cdrtools 3.01? Anyway, will try the patch and let you know.
Comment 5 Guangyuan Yang freebsd_committer freebsd_triage 2017-07-23 19:38:41 UTC
(In reply to Marius Strobl from comment #3)

Probably a newbie question, but how do I apply the patch? It seems to be a diff of Makefile and diskinfo, but not the actual code.
Comment 6 Ed Maste freebsd_committer freebsd_triage 2017-07-24 02:00:42 UTC
As a point of reference a number of OS distributions ship cdrtools 3.02 alpha 7 as their cdrtools package -- https://repology.org/metapackage/cdrtools/versions

Of course this doesn't necessarily mean that FreeBSD should also do this; I point it out only to demonstrate that others have apparently had to find ways around upstream's lethargic release schedule.
Comment 7 Guangyuan Yang freebsd_committer freebsd_triage 2017-07-24 16:19:01 UTC
(In reply to Marius Strobl from comment #3)

Applying the patch you provided fixes the problem. However, I found something interesting in the patched version of cdrtools 3.01:

# isoinfo --version
isoinfo 3.02a02 (amd64-unknown-freebsd12.0) Copyright (C) 1993-1999 Eric Youngdale (C) 1999-2015 Joerg Schilling
Comment 8 Marius Strobl freebsd_committer freebsd_triage 2017-07-25 20:00:26 UTC
(In reply to Guangyuan (Charlie) Yang from comment #7)

Yes, that's more or less expected; apparently, the patch for 3.01 was generated
based on a 3.02 alpha version, but only the version string of mkisofs adjusted
accordingly and that of isoinfo forgotten.
Comment 9 Guangyuan Yang freebsd_committer freebsd_triage 2017-07-25 20:08:56 UTC
(In reply to Marius Strobl from comment #8)

If that's just a version number issue, do you think we can apply this patch to sysutils/cdrtools then? (Or it's already been applied?) 

I am working on solving sysutils/py-diffoscope test cases (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220870) and some of the errors come from this bug.
Comment 10 commit-hook freebsd_committer freebsd_triage 2017-07-25 20:11:43 UTC
A commit references this bug:

Author: marius
Date: Tue Jul 25 20:11:28 UTC 2017
New revision: 446622
URL: https://svnweb.freebsd.org/changeset/ports/446622

Log:
  Integrate an official patch for isoinfo and mkisofs which adds directory
  loop recognition in order to prevent from an endless loops that in turn
  may consume all available memory.

  PR:	220868

Changes:
  head/sysutils/cdrtools/Makefile
  head/sysutils/cdrtools/distinfo
Comment 11 Marius Strobl freebsd_committer freebsd_triage 2017-07-25 20:18:16 UTC
(In reply to Guangyuan (Charlie) Yang from comment #9)

The cdrtools source regularly suffers from issues such as fuckups in version
numbers, unexpanded license boiler plates etc. so I saw no reason for not
integrating that patch.
Comment 12 Guangyuan Yang freebsd_committer freebsd_triage 2017-07-25 20:19:19 UTC
(In reply to Marius Strobl from comment #11)

Haha, thanks!