History log of /freebsd-11-stable/usr.sbin/makefs/cd9660.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 332983 25-Apr-2018 benno

MFC r331463 (partial), r331467, r331468, r331843

r331463, r331467, and r331468 are all replaced by r331843 but are included for
completeness' sake. r331463 also contained a change to
release/amd64/mkisoimages.sh which I've left out since those changes were
also obsoleted by a later commit which will be merged later.

r331843:

Synchronise with NetBSD's version of EFI handling for El Torito images.

Sponsored by: iXsystems, Inc.


# 332981 25-Apr-2018 benno

MFC r316579

makefs: use emalloc and friends

The emalloc set of error-checking memory allocation routines were added
to libnetbsd in r316572. Use them in makefs to reduce differences with
NetBSD.

NetBSD revs:
cd9660.c 1.39
ffs.c 1.56
makefs.c 1.42
walk.c 1.27
cd9660/cd9660_archimedes.c 1.2
cd9660/cd9660_eltorito.c 1.20
cd9660/cd9660_write.c 1.16
cd9660/iso9660_rrip.c 1.12
ffs/buf.c 1.17
ffs/mkfs.c 1.26

Sponsored by: iXsystems, Inc.


# 332980 25-Apr-2018 benno

MFC r307927

Be more precise when including headers so that we're less likely to
depend on namespace pollution and as such become more portable. This
means including headers like <sys/types.h> or <stdlib.h>, but also
making sure we include system/host headers before local headers.

While here: define ENOATTR as ENOMSG in mtree.c. There is no ENOATTR
on Linux.

With this, makefs is ready for compilation on macOS and Linux.

Sponsored by: iXsystems, Inc.


# 332978 25-Apr-2018 benno

MFC r315304

makefs: sync option parsing with NetBSD

- add support for parsing different types; not just int
- homogenize option parsing
- fix single letter parsing
- remove duplicated code

NetBSD revisions:
cd9660.c 1.36 1.37 1.38 1.41 1.42 1.43
ffs.c 1.50 1.51 1.52 1.53 1.56 1.57
makefs.c 1.36 1.37 1.38 1.39 1.40 1.42 1.43 1.44 1.46
makefs.h 1.28 1.29 1.31 1.32

Sponsored by: iXsystems, Inc.


# 332977 25-Apr-2018 benno

MFC r314117

makefs: eliminate global cd9660 structure

For diff reduction with NetBSD

NetBSD file versions:
cd9660.c 1.39
cd9660.h 1.19
cd9660/cd9660_debug.c 1.12
cd9660/cd9660_eltorito.c 1.20
cd9660/cd9660_write.c 1.16
cd9660/iso9660_rrip.c 1.12
cd9660/iso9660_rrip.h 1.6

Sponsored by: iXsystems, Inc.


# 330976 15-Mar-2018 eadler

MFC r303036,r303038,r306822,r307923,:

makefs: reorder 'usage' alphabetically

From NetBSD, Mon Aug 15 14:45:01 2011 +0000 (wiz)

Re-order `usage' alphabetically;
rename option arguments in the manpage's `SYNOPSIS' section to
match those from `usage' (not the other way around; the `usage'-line
(and other parts of makefs.c) contain the correct names);
minor punctuation improvements.

From Snader_LB.

makefs.8 1.36
makefs.c 1.30

Obtained from: NetBSD

------------------------------------------------------------------------
r303038 | emaste | 2016-07-19 18:40:54 +0000 (Tue, 19 Jul 2016) | 56 lines

makefs: sync NetBSD IDs with upstream for changes that we already have

May 22 21:51:39 2011 +0000 (christos):

From Nathan Whitehorn (nwhitehorn at freebsd dot org):
Add code to generate bootable ISOs on Powermac and CHRP systems.
Synthesize some partition maps (APM and MBR, respectively) pointing
to (a) the whole disk, and (b) relevant El Torito boot images that
have been added by other code. These partition maps are a little
bit funny looking, but they seem to work. FreeBSD has been using
this successfully in their release generation on powerpc, as well
as generating all non-SPARC install media. SPARC support could
probably be added as an extension of this patch.

makefs.8 1.33

Tue Aug 23 17:09:11 2011 +0000 (christos):

PR/45285: Martin Matuska: makefs does not properly convert ISO level 1 and 2
filenames (buffer overflow)

makefs does not properly verify the maximum filename length in the
special "." case for both ISO level 1 and ISO level 2 filename
conversion. This creates broken images or causes a buffer overflow
(ISO level 2).

ISO level 1:
If a filename contains only dots or up to 8 characters followed by
dots the 8+3 limit check doesn't work.

ISO level 2:
If a filename contains a dot in the first 30 characters and a dot
on the 30th character, the length limit check doesn't work and the
buffer is overflowed.

$ mkdir level1
$ touch level1/12345............
$ makefs -t cd9660 -o isolevel=1 test.iso level1

$ mkdir level2
$ touch level2/1234567890.2345678901234567.....34567890123456789012345
$ makefs -t cd9660 -o isolevel=2 test.iso level2

cd9660.c 1.32

Sun Oct 9 21:33:43 2011 +0000 (christos):

add support for setting the ufs label. (Nathan Whitehorn)

ffs.c 1.45
ffs.h 1.2
mkfs.c 1.22
makefs.8 1.37

Obtained from: NetBSD

------------------------------------------------------------------------
r306822 | emaste | 2016-10-07 19:12:15 +0000 (Fri, 07 Oct 2016) | 4 lines

makefs: diff reduction with NetBSD

Obtained from: NetBSD usr.sbin/makefs/cd9660.c 1.33

------------------------------------------------------------------------
r307923 | marcel | 2016-10-25 16:21:38 +0000 (Tue, 25 Oct 2016) | 7 lines

Allow building makefs(8) from another Makefile (such as one in
a seperate directory hierarchy used to build tools). This boils
down to replacing the use of ${.CURDIR} with either ${SRCDIR}
or ${SRCTOP}. SRCDIR is defined as the directory in which the
Makefile lives that bmake(1) is currently reading. Use SRCTOP
when reaching outside of makefs's directory.


# 330449 05-Mar-2018 eadler

MFC r326276:

various: general adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.


# 316199 30-Mar-2017 sevan

MFC r309192

Fix null dereference when running out of nodes during rename.

PR: 212370
Submitted by: Sascha Wildner <swildner AT gmail>
Reviewed by: bcr (mentor)
Approved by: bapt
Obtained from: NetBSD
Differential Revision: https://reviews.freebsd.org/D8643


# 302408 07-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
# 301879 14-Jun-2016 emaste

makefs: Provide a -T option to set timestamps to a consistent value

This is taken from the NetBSD versions listed below and adapted to the
makefs version in FreeBSD, along with a bug fix from cem@ that will be
sent to NetBSD.

Reviewed by: pfg
Approved by: re (gjb)
Obtained from: NetBSD
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D6835


# 300170 18-May-2016 sjg

Initialize date of rootNode.

Reviewed by: jtl


# 300064 17-May-2016 pfg

makefs(8): use NULL instead of zero for pointers.


# 290264 02-Nov-2015 ngie

Limit isoLevel to 1 and 2 to avoid segfaulting when isoLevel is set to 3 by
dereferencing a NULL function pointer

Add some asserts to ensure that isolevel is always either 1 or 2.

PR: 203645
Reported by: Thomas Schmitt <scdbackup@gmx.net>
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


# 289677 21-Oct-2015 eadler

Fix a ton of speelling errors

arc lint is helpful

Reviewed By: allanjude, wblock, #manpages, chris@bsdjunk.com
Differential Revision: https://reviews.freebsd.org/D3337


# 289601 19-Oct-2015 ngie

Don't check if `val` is NULL before calling free; free(3) already
handles this

MFC after: 1 week
PR: 203649
Submitted by: Thomas Schmitt <scdbackup@gmx.net>
Coverity CID: 1305659
Sponsored by: EMC / Isilon Storage Division


# 253707 27-Jul-2013 marius

- Set the System Identifier in the Primary Volume Descriptor to FreeBSD
rather than NetBSD.
- Correctly set the Expiration Time in the Primary Volume Descriptor;
according to ISO 9660 8.4.26.1 unspecified date and time are denoted
by the digit 0 in RBP 1 to 16 but the number 0 in RBP 17. [1]
- Merge iso9660_rrip.c rev. 1.11 from NetBSD: name_len should be read
as unsigned byte. [2]
Note: This is according to ISO 9660 9.1.10.
- Rock Ridge TF entries should use a length of 5, because after the 4
bytes of generic SUSP header there is one byte of flags. See typedef
of ISO_RRIP_TF in iso9660_rrip.h. [1]

Submitted by: Thomas Schmitt [1]
Obtained from: NetBSD [2]
MFC after: 3 days


# 230795 30-Jan-2012 jkim

Allow contents of multiple directories to be merged to the current image.
Note this patch was submitted to NetBSD and they already adopted it.

http://mail-index.netbsd.org/source-changes/2012/01/28/msg031078.html

MFC after: 1 week


# 230529 25-Jan-2012 hrs

Fix a SIGSEGV problem in directory entry renaming.


# 230355 19-Jan-2012 eadler

Fix warning when compiling with gcc46:
error: variable 'parentrecnum' set but not used

Approved by: dim, cperciva (mentor, blanket for pre-mentorship already-approved commits)
MFC after: 3 days


# 230354 19-Jan-2012 eadler

Fix a variety of warnings when compiling with gcc46

Approved by: dim, cperciva (mentor, blanket for pre-mentorship already-approved commits)
MFC after: 3 days


# 230353 19-Jan-2012 eadler

Fix warning when compiling with gcc46:
error: variable 'temp' set but not used

Approved by: dim
Approved by: cperciva (mentor, blanket for pre-mentorship already-approved commits)
MFC after: 3 days


# 225121 23-Aug-2011 mm

Fix buffer overflow and possible ISO image corruption in wrong
handling of "." character case in makefs ISO level 1 and 2 filename
conversion.

Filed as NetBSD PR #45285
http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=45285

Reviewed by: Christos Zoulas <christos@netbsd.org>
Approved by: re (kib)
MFC after: 3 days


# 224762 10-Aug-2011 marius

Sync makefs(8) ISO 9660 support with NetBSD:
o cd9960 -> cd9660
o Move inclusion of sys/endian.h from cd9660_eltorito.c to cd9660.h
since actual user is not cd9660_eltorito.c but iso.h and
cd9660_eltorito.h.

Actually, include order/place of sys/endian.h doesn't matter on
netbsd since it is always included by sys/types.h but it's not
true on other system. This should fix cross build breakage on
freebsd introduced by rev. 1.16 of cd9660_eltorito.c.
Problem reported and fix suggested on twitter.
o Fix fd leaks in error cases. Found by cppcheck.
o RRIP RE length should be 4, not 0
o Apply fixes for PR bin/44114 (makefs(8) -t cd9660 -o rockridge creates
corrupted cd9660fs), iso9660_rrip.c part:
- cd9660_rrip_finalize_node() should check rr_real_parent in node->parent,
not in node itself in RRIP_PL case
- cd9660_rrip_initialize_node() should update only node passed as arg
so handle RRIP_PL in DOTDOT case

Fixes malformed dotdot entries in deep (more than 8 level) directories
moved into .rr_moved dir.

Should be pulled up to netbsd-5.
(no official ISO has such deep dirs, but cobalt restorecd is affected)

Reviewed by: mm
Approved by: re (kib)
Obtained from: NetBSD
MFC after: 3 days


# 224690 07-Aug-2011 mm

Fix NetBSD PR bin/44114:
makefs with -t cd9660 -o rockridge against directories with
deep structure creates a corrupted cd9660 image.

http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=44114

Fix NetBSD PR bin/45217:
makefs creates ISO9660 images that violate the ECMA-119 (ISO9660)
specification. This is caused by erroneously writing 32 bytes
with value 0x20 to the volume_set_id field and 128 bytes with value 0x20
to the the following 37-byte fields in the PVD:
copyright_file_id, abstract_file_id, bibliographic_file_id

This causes, among other unwanted results the reserved4 field to be
overwritten with the value 0x20. To comply with the specification,
this field muse be zero. As a result, all FreeBSD distribution
images created with makefs have not been 100% valid ISO9660 files.

http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=45217

Reviewed by: kientzle
Approved by: re (kib)
Obtained from: NetBSD
MFC after: 3 days


# 222191 22-May-2011 nwhitehorn

Add analogs to the -chrp-boot and -prep-boot options to mkisofs.


# 214921 07-Nov-2010 cognet

Sync with the latest version from NetBSD. It notably addds ISO9660 support.

Submitted by: bapt