Home | History | Annotate | Download | only in makefs
History log of /src/usr.sbin/makefs/cd9660.c
RevisionDateAuthorComments
 1.60  28-Dec-2023  tsutsui Use EXIT_SUCCESS and EXIT_FAILURE where appropriate per style guide.
 1.59  18-Apr-2023  christos Move date setting into cd9660_populate_iso_dir_record so there is no
path that leaves it unset.

From FreeBSD https://reviews.freebsd.org/D39258
 1.58  21-Dec-2021  andvar s/filname/filename/
 1.57  10-Nov-2020  reinoud rock_ridge_move_count is only incremented and can never be negative so change
%08i to %08u.
This removes a warning when compiling with tools outside ./build.sh
 1.56  18-Oct-2019  msaitoh s/initalize/initialize/ in comment or printf message.
 1.55  15-Mar-2017  christos branches: 1.55.12;
Change duplicate 'D' option to 'm'. From Ed Maste @ FreeBSD
 1.54  24-Jan-2017  nonaka makefs(8): add cd9660 eltorito-alt-boot option for EFI boot.
 1.53  25-Nov-2016  christos branches: 1.53.2;
PR/51652: Sevan Janiyan: makefs dies due to segmentation fault
Don't dereference NULL when running out of nodes during rename.
 1.52  24-Dec-2015  christos branches: 1.52.2;
little size_t/ssize_t...
 1.51  21-Dec-2015  christos Fix some more MKREPRO issues in cdrom creation. Now amd64 passes MKREPRO.
 1.50  25-Nov-2015  christos Provide a -T option to set timestamps to a consistent value for MKREPRO
 1.49  17-Jun-2015  christos more error normalization
 1.48  16-Jun-2015  christos improve error messages (remove \n, use __func__, etc)
 1.47  24-Oct-2013  apb Now that tools/compat/compat_defs.h defones __USE, there's no
need to treat the tools build as a special case.
 1.46  19-Oct-2013  mrg avoid using __USE() in the tools version of this.
 1.45  19-Oct-2013  christos fix unused variable warnings.
 1.44  30-Jul-2013  reinoud `makefs -t cd9660' fix from FreeBSD:
Submitted by: Thomas Schmitt via marius@freebsd.org
Obtained from: FreeBSD r253707

- 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.

- 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.43  31-Jan-2013  christos macroize to make it more type-safe.
 1.42  31-Jan-2013  christos the allow options are 8 bits wide.
 1.41  29-Jan-2013  christos make everything use the generic options parser.
 1.40  29-Jan-2013  christos handle some of the options by the generic parser.
 1.39  28-Jan-2013  christos - use emalloc and friends
- kill a bunch of global variables, more work to be done here
- homogenize option parsing. more work for cd9660
- use the new options parsing code to print an fs-specific usage
 1.38  24-Jan-2013  christos - Fix single letter option parsing.
- Instead of returning 1 << index and 0 on error,
return just index and -1 on error for the set_option*() routines.
 1.37  23-Jan-2013  christos remove duplicated code, and try to cleanup parsing by using the shared code.
cd9660 needs a lot of work.
 1.36  23-Jan-2013  christos - add support for parsing different types; not just int.
- add beginning of msdos support.
 1.35  28-Jan-2012  christos branches: 1.35.6;
Patch from Jung-uk Kim (jkim at FreeBSD dot org) to allow contents of multiple
directories to be merged to the current image.
 1.34  23-Aug-2011  christos branches: 1.34.2;
more fixes from martin
 1.33  23-Aug-2011  christos remove stray brace, minor knf
 1.32  23-Aug-2011  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
 1.31  06-Aug-2011  christos PR/45217: Martin Matuska: Use proper lengths to space pad fields and don't
overwrite them according to the spec.
 1.30  29-May-2011  tsutsui Apply fixes for PR bin/44114 (makefs(8) -t cd9660 -o rockridge creates
corrupted cd9660fs):
- makefs/cd9660.c:
- cd9660_rrip_move_directory() should also update lenght[0] and
name_len[0] in dir->isoDirRecord
- makefs/cd9660/iso9660_rrip.c:
- 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)
 1.29  22-May-2011  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.
 1.28  19-Nov-2010  tsutsui cd9960 -> cd9660
 1.27  27-Oct-2010  christos Handle > 2GB images. Thanks to Greg Troxel for testing!
 1.26  16-Jan-2009  pooka remove fsopts asserts - the parameter is unused, so we don't care here
 1.25  10-Jan-2009  bjh21 Add support for encoding RISC OS metadata into ISO 9660 filesystems.
This is done by adding the general ability to stuff non-SUSP data into
the end of the System Use field of a Directory Record, which required
some amount of rewriting of the SUSP support. I think the result is
at least as good as what came before, and I've fixed at least one bug
along the way. Tested against RISC OS 3.70 on my Risc PC.

Oh, why do we want it? It should allow us to make acorn{26,32} CDs that
can be booted directly from RISC OS without mucking around copying the
bootloader to a native filing system.
 1.24  08-Jan-2009  bjh21 If the user specifies a cd9660-specific option that needs an integer value
without supplying a value, complain at them instead of segfaulting.
Or, to put it another way, check that the value is non-NULL before calling
set_option().
 1.23  21-Nov-2008  ad Make the allow-multidot option useful.
 1.22  30-Oct-2008  ahoka branches: 1.22.2;
Import changes from the MirBSD Project:

Initialise memory before writing to only part of it,
making sure that the string is NUL-terminated

Allocate the maximum allowed length (including the
terminating NUL byte) for the temporary name string, make sure
the final output is NUL terminated, and copy back the NUL when
overwriting the previously created name (since maxlen is always
at least 1 less than ISO_FILENAME_MAXLENGTH_WITH_PADDING, this
is no problem)

Patches from Thorsten Glaser through freenode.net.
 1.21  27-Jul-2008  reinoud Fix typo in cd9660 functionname cd9660_setup_boot_volume_descritpor ->
cd9660_setup_boot_volume_descriptor.

Interestingly the same typo was used in 3 files!
 1.20  10-May-2008  skrll Add an option to load a generic boot image into the first 32K of the
cd9660 image.
 1.19  07-Apr-2007  christos branches: 1.19.10; 1.19.12;
Fix deep directory move rock-ridge extension. Code was there, but it had
bit-rotted.
 1.18  16-Jan-2007  hubertf * Don't include headers twice
* Remove a few trailing whitespaces
* Rearrange and join to one #if for some headers

Patch contributed by Slava Semushin <slava.semushin@gmail.com>
in private mail.
 1.17  18-Dec-2006  christos from Anon Ymous: compile with -Wextra
 1.16  22-Oct-2006  christos branches: 1.16.2; 1.16.4;
use c99 initializers
 1.15  10-Oct-2006  dbj implement -x by pruning fsnodes tree before building filesystem rather
than by skipping nodes while building filesystem
 1.14  08-Oct-2006  dbj make -t cd9660 obey -x option similarly to ffs
 1.13  01-Jun-2006  hubertf Fix fix for Coverity CID 2751:

Move an error check to the right place, and instead of blindly insisting on
an argument for all of "no-emul-boot", "no-boot", "hard-disk-boot" and
"boot-load-segment", only require it for the last one, which is the only
one that requires/uses it.

OK'd by Christos
 1.12  25-May-2006  christos Coverity CID 2751: Avoid NULL deref.
 1.11  30-Nov-2005  dyoung Fix a bug in cd9660_sort_nodes, which tried to insert `next' before
`node' on a tail-queue, when `node' wasn't on the tail-queue.
Sometimes this led to a segfault. Insert before `cn', since that
is the intention. Closes PR 32194. Thanks, Jeff Rizzo, for reporting
this bug.
 1.10  31-Oct-2005  dyoung Change cd9660's default verbosity level to 0, quieting it down
considerably.
 1.9  31-Oct-2005  dyoung Remove the cd9660_inode hashtable for hard-links support, and re-use
the fsinode for the same purpose, per Luke Mewburn's suggestion on
source-changes@.
 1.8  30-Oct-2005  dyoung Add hard-link support: keep a hashtable that maps inodes for
regular files on the source filesystem to the offset of the first
data block on the target filesystem. Don't allocate blocks for a
file a second time (i.e., if it is already present in the hashtable).
Avoid writing the blocks of a file twice (use the FS_WRITTEN flag
in fsinode->flags for this purpose).
 1.7  30-Oct-2005  dyoung Bug fix: record the actual number number of 512-byte "virtual"
sectors in the Sector Count field of the Initial/Default Entry in
the "El Torito" Boot Catalog, instead of blithely writing 1 (!!)
into the Sector Count field. Ditto the Section Entries.

Remove last remnants of cd9660's unsupported boot-load-size option.

Really use cd9660's boot-load-segment argument.

Change the boot images list from a LIST to a TAILQ.

Re-implement CD9660_BLOCKS() with howmany().

Introduce ELTORITO_DPRINTF and some debug messages.

Zero memory malloc'd in the El Torito code.

Revise some debugging outputs.

Insert a new boot-image on the boot-images list after the last
boot-image for the same architecture. It makes a (trivial) functional
difference.

Miscellaneous cosmetic changes. Remove useless variable-assignment.
 1.6  30-Oct-2005  dyoung Remove invisible whitespace at ends of lines that disrupted my
speedy cursor-movement habits in vi.
 1.5  25-Oct-2005  dyoung Overhaul makefs -t cd9660.

Functional: Do not add a missing period or a version number to
directories, since that doesn't fit the standard (thanks
Daniel Watt).

Add RRIP PX records (POSIX meta-information) to '.'
and '..' entries. Quiets kernel complaint, when we
mount a cd9660 filesystem, that there is a missing PX
entry.

Cosmetic: Reduce height of staircases. Remove an unused member
from struct _cd9660node. Extract a subroutine. KNF.

Use a TAILQ macros for lists of both SUSP/RRIP attributes
and directory entries.

XXX
XXX The new RRIP PX entries are not quite right.
XXX
 1.4  11-Sep-2005  dyoung Cosmetic: change to a standard idiom, *(x++) --> *x++. Flag some
places needing bounds-checking with XXX. Fix indendation.
 1.3  11-Sep-2005  dyoung By default, do not omit the trailing period from ISO9660 filenames
unless given the option '-o omit-trailing-period'. Also, fix a
logic error so that makefs obeys option '-o omit-trailing-period'
when it is given.
 1.2  15-Aug-2005  he Move local variable declaration to start of block (also start of function).
Fixes build problem for vax.
 1.1  13-Aug-2005  fvdl cd9660 support. Written by Daniel Watt, Walter Deignan, Ryan Gabrys,
Alan Perez-Rathke and Ram Vedam.

Prototyping, KNF, WARNS=3 by me.

Note that this is marked experimental for now. It works well enough to
make NetBSD/i386 bootable images, but does need more work.
 1.16.4.1  03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.16.2.1  31-Aug-2007  pavel Pull up following revision(s) (requested by christos in ticket #757):
usr.sbin/makefs/cd9660.c: revision 1.19
Fix deep directory move rock-ridge extension. Code was there, but it had
bit-rotted.
 1.19.12.2  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.19.12.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.19.10.1  18-May-2008  yamt sync with head.
 1.22.2.3  15-Jul-2011  riz Pull up following revision(s) (requested by tsutsui in ticket #1638):
usr.sbin/makefs/cd9660/iso9660_rrip.c: revision 1.9
usr.sbin/makefs/cd9660/iso9660_rrip.c: revision 1.10
usr.sbin/makefs/cd9660.c: revision 1.30
- remove unnecessary (pasto?) line on RRIP PL handling for moved dir
- RRIP RE length should be 4, not 0
Apply fixes for PR bin/44114 (makefs(8) -t cd9660 -o rockridge creates
corrupted cd9660fs):
- makefs/cd9660.c:
- cd9660_rrip_move_directory() should also update lenght[0] and
name_len[0] in dir->isoDirRecord
- makefs/cd9660/iso9660_rrip.c:
- 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)
 1.22.2.2  02-Jan-2010  snj Pull up following revision(s) (requested by tsutsui in ticket #1198):
usr.sbin/makefs/cd9660.c: revision 1.25 via patch
usr.sbin/makefs/cd9660.h: revision 1.13 via patch
usr.sbin/makefs/cd9660/cd9660_write.c: revision 1.10
usr.sbin/makefs/cd9660/iso9660_rrip.c: revision 1.8
usr.sbin/makefs/cd9660/iso9660_rrip.h: revision 1.5
Add support for encoding RISC OS metadata into ISO 9660 filesystems.
This is done by adding the general ability to stuff non-SUSP data into
the end of the System Use field of a Directory Record, which required
some amount of rewriting of the SUSP support. I think the result is
at least as good as what came before, and I've fixed at least one bug
along the way. Tested against RISC OS 3.70 on my Risc PC.
Oh, why do we want it? It should allow us to make acorn{26,32} CDs that
can be booted directly from RISC OS without mucking around copying the
bootloader to a native filing system.
 1.22.2.1  02-Feb-2009  snj branches: 1.22.2.1.2; 1.22.2.1.4;
Pull up following revision(s) (requested by ad in ticket #347):
usr.sbin/makefs/cd9660.c: revision 1.23
Make the allow-multidot option useful.
 1.22.2.1.4.1  21-Apr-2010  matt sync to netbsd-5
 1.22.2.1.2.1  02-Jan-2010  snj Pull up following revision(s) (requested by tsutsui in ticket #1198):
usr.sbin/makefs/cd9660.c: revision 1.25 via patch
usr.sbin/makefs/cd9660.h: revision 1.13 via patch
usr.sbin/makefs/cd9660/cd9660_write.c: revision 1.10
usr.sbin/makefs/cd9660/iso9660_rrip.c: revision 1.8
usr.sbin/makefs/cd9660/iso9660_rrip.h: revision 1.5
Add support for encoding RISC OS metadata into ISO 9660 filesystems.
This is done by adding the general ability to stuff non-SUSP data into
the end of the System Use field of a Directory Record, which required
some amount of rewriting of the SUSP support. I think the result is
at least as good as what came before, and I've fixed at least one bug
along the way. Tested against RISC OS 3.70 on my Risc PC.
Oh, why do we want it? It should allow us to make acorn{26,32} CDs that
can be booted directly from RISC OS without mucking around copying the
bootloader to a native filing system.
 1.34.2.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.34.2.1  17-Apr-2012  yamt sync with head
 1.35.6.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.35.6.1  25-Feb-2013  tls resync with head
 1.52.2.2  20-Mar-2017  pgoyette Sync with HEAD
 1.52.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.53.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.55.12.1  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411

RSS XML Feed