Subject: pkg/37643: mkisofs(8) in cdrtools-2.01.01.36 dumps core in src/distrib/cdrom
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <tsutsui@ceres.dti.ne.jp>
List: pkgsrc-bugs
Date: 12/29/2007 14:00:01
>Number:         37643
>Category:       pkg
>Synopsis:       mkisofs(8) in cdrtools-2.01.01.36 dumps core in src/distrib/cdrom
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 29 14:00:00 +0000 2007
>Originator:     Izumi Tsutsui
>Release:        NetBSD 4.0
>Organization:
>Environment:
System: NetBSD 4.0 Release
Architecture: i386
Machine: i386
>Description:
mkisofs(8) in cdrtools-2.01.01.36 dumps core in src/distrib/cdrom
on creating any cd images as following:

---
% cd /usr/src/distrib/cdrom
% make TARGET_CD_IMAGE=i386cd RELEASE=4.0
mkdir -p /usr/src/distrib/cdrom/obj.i386/staging/i386cd-4.0 /usr/src/distrib/cdrom/obj.i386/extfiles
rm -f /usr/src/distrib/cdrom/obj.i386/staging/i386cd-4.0.pathlist /usr/src/distrib/cdrom/obj.i386/i386cd-4.0.contents
[1]   Segmentation fault (core dumped) /usr/pkg/bin/mki... |
      Done                    tee /dev/stderr |
      Done                    sed "/=/!d;s/^[^...
sh: arithmetic expression: syntax error: " * 2048"
*** Error code 2

Stop.
make: stopped in /usr/src/distrib/cdrom
% 
---

The actual command which dumps core is:
---
cd /usr/src/distrib/cdrom/obj.i386/staging/i386cd-4.0 && \
/usr/pkg/bin/mkisofs -o /usr/src/distrib/cdrom/obj.i386/i386cd-4.0.iso \
-hide-rr-moved -m Split -m cdrom \
-publisher "The NetBSD Foundation, Inc. / http://www.NetBSD.org/" \
-p "NetBSD CD Build System" -r -l -J \
-hide-joliet-list /usr/src/distrib/cdrom/hide-jol.lst \
-V "NetBSD 4.0 i386cd" -graft-points \
-path-list /usr/src/distrib/cdrom/obj.i386/staging/i386cd-4.0.pathlist \
-apple --macbin -map /usr/src/distrib/cdrom/hfsmap.lst .

---

gdb backtrace says:
---
% grep NAME= /usr/pkgsrc/sysutils/cdrtools/Makefile 
DISTNAME=       cdrtools-2.01.01a36
PKGNAME=        cdrtools-2.01.01.36
% gdb /usr/pkgsrc/sysutils/cdrtools/work.i386/cdrtools-2.01.01/mkisofs/OBJ/i386-netbsd-cc/mkisofs /usr/src/distrib/cdrom/obj.i386/staging/i386cd-4.0/mkisofs.core 
GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386--netbsdelf"...(no debugging symbols found)

Reading symbols from /usr/lib/libintl.so.0...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libintl.so.0
Reading symbols from /usr/lib/libutil.so.7...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libutil.so.7
Reading symbols from /usr/lib/libc.so.12...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libc.so.12
Reading symbols from /usr/lib/i18n/libiconv_std.so.4.4...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/i18n/libiconv_std.so.4.4
Reading symbols from /usr/lib/i18n/libUTF1632.so.4.4...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/i18n/libUTF1632.so.4.4
Reading symbols from /usr/lib/i18n/libmapper_std.so.4.4...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/i18n/libmapper_std.so.4.4
Reading symbols from /usr/libexec/ld.elf_so...
(no debugging symbols found)...done.
Loaded symbols for /usr/libexec/ld.elf_so
Core was generated by `mkisofs'.
Program terminated with signal 11, Segmentation fault.
#0  0x0805f980 in conv_charset ()
(gdb) backtrace
#0  0x0805f980 in conv_charset ()
#1  0x0806931d in hstrncpy ()
#2  0x0806a149 in get_none_info ()
#3  0x0806bba9 in get_hfs_info ()
#4  0x08051aaf in insert_file_entry ()
#5  0x08052214 in scan_directory_tree ()
#6  0x0804a6c5 in get_graft ()
#7  0x0804ca1d in main ()
(gdb) 
---

Looks "-apple --macbin -map [map]" options for HFS support
cause the problem, but I have not tracked it.

mkisofs binary in cdrtools-2.01.01.35.tgz in packages has the same problem.

>How-To-Repeat:
pkg_add ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD-4.0/i386/net/rsync-2.6.9nb1.tgz
pkg_add ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD-4.0/i386/sysutils/cdrtools-2.01.01.35.tgz
[fetch 4.0 sources and build tools]
cd /usr/src/cdrom/distrib
make TARGET_CD_IMAGE=i386cd RELEASE=4.0 obj
make TARGET_CD_IMAGE=i386cd RELEASE=4.0 fetch
make TARGET_CD_IMAGE=i386cd RELEASE=4.0

>Fix:
For temporary workaround cdrtools-2.01.01.27nb1 works without a problem.
---