git: makefs(8): Sync cd9660 function with FreeBSD

Aaron LI aly at crater.dragonflybsd.org
Tue Feb 18 17:42:00 PST 2025


commit 4834b23f9cda141ba3d94f2ecc1e9388aba1ac55
Author: Aaron LI <aly at aaronly.me>
Date:   Wed Feb 19 09:01:16 2025 +0800

    makefs(8): Sync cd9660 function with FreeBSD
    
    The major changes are (in chronological order):
    
    * makefs: connect cd9660 El Torito EFI boot image system type
    
    * Fix -Wpointer-sign warnings in makefs and mkimg
    
    * makefs: correct iso9660 Rock Ridge TF timestamps
    
      The bit definitions for the TF_* timestamp bits (TF_MODIFY, etc.) were
      incorrect, and timestamps were written in the wrong order.
    
      See RRIP 4.1.6 Description of the "TF" System Use Entry for details.
    
      PR:		203531
      Reported by:	Thomas Schmitt <scdbackup at gmx.net>
      Reviewed by:	jrtc27, kevans
      Sponsored by:	The FreeBSD Foundation
      Differential Revision: https://reviews.freebsd.org/D39221
    
    * makefs: correct iso9660 Rock Ridge NM values
    
      These are not actually used by makefs (yet), but ought to match the
      spec.
    
      See RRIP 4.1.4 Description of the "NM" System Use Entry for details.
    
      PR:		203531
      Sponsored by:	The FreeBSD Foundation
    
    * makefs: correct El Torito bood record
    
      The boot catalog pointer is a DWord, but we previously populated it via
      cd9660_bothendian_dword which overwrote four unused bytes following it.
      See El Torito 1.0 (1995) Figure 7 for details.
    
      PR:		203531
      Reported by:	Coverity Scan
      Reported by:	Thomas Schmitt <scdbackup at gmx.net>
      Reviewed by:	kevans
      CID:		977470
      Sponsored by:	The FreeBSD Foundation
      Differential Revision: https://reviews.freebsd.org/D39231
    
    * makefs: emit NM records for all directory entries
    
      We previously attempted to emit Rock Ridge NM records only when the name
      represented by the Rock Ridge extensions would actually differ. We would
      omit the record for an all-upper-case directory name, however Linux (and
      perhaps other operating systems) map names with no NM record to
      lowercase.
    
      This affected only directories, as file names have an implicit ";1"
      version number appended and thus always differ.  To solve, just emit NM
      records for all entries other than DOT and DOTDOT .
    
      We could continue to omit the NM record for directories that would avoid
      mapping (for example, one named 1234.567) but this does not seem worth
      the complexity.
    
      PR:		203531
      Reported by:	Thomas Schmitt <scdbackup at gmx.net
      Reviewed by:	kevans
      Sponsored by:	The FreeBSD Foundation
      Differential Revision: https://reviews.freebsd.org/D39258
    
    * makefs: #define Apple Partition bits
    
      NetBSD defines these in sys/bootblock.h, which we don't have.  Add local
      defintions in cd9660_eltorito.c (as OpenBSD did) to reduce diffs between
      the three makefs implementations.
    
      Obtained from:	OpenBSD
      Sponsored by:	The FreeBSD Foundation
    
    * makefs: avoid uninitialized memory in root directory date
    
      Move date setting into cd9660_populate_iso_dir_record so there is no
      path that leaves it unset.
    
      PR:             203531
      Reported by:    Thomas Schmitt <scdbackup at gmx.net>
      Reviewed by:    markj
      Sponsored by:   The FreeBSD Foundation
      Differential Revision: https://reviews.freebsd.org/D39258
    
    * makefs: simplify filename conversion handling
    
      Obtained from:  OpenBSD 4095a2e01d18
      Sponsored by:   The FreeBSD Foundation
    
    * makefs: set the validation entry system type
    
      Obtained from:	NetBSD c3cb4dcc9c43
      Sponsored by:	The FreeBSD Foundation
    
    * makefs: remove unused cd9660 options
    
      Makefs defined "follow-symlinks" and "help" options, but they did
      nothing.  Remove them.
    
      Obtained from:  OpenBSD a8f1645688c2
      Sponsored by:   The FreeBSD Foundation
    
    * makefs: set cd9660 Rock Ridge timestamps for . and ..
    
      DOT and DOTDOT entries have special handling, and previously only Rock
      Ridge PX (POSIX attributes) entries were attached.  Add TF (timestamp)
      entries as well.
    
      PR:		203531
      Reported by:	Thomas Schmitt <scdbackup at gmx.net>
      Reviewed by:	markj
      Sponsored by:	The FreeBSD Foundation
      Differential Revision: https://reviews.freebsd.org/D39662
    
    * makefs: remove ISO9660 Archimedes extension support
    
      We have no need to create ISO images with RISC OS specific metadata.
    
      Reviewed by:	imp
      Relnotes:	yes
      Obtained from:	OpenBSD a435da44c07f
      Sponsored by:	The FreeBSD Foundation
      Differential Revision: https://reviews.freebsd.org/D39344
    
    * makefs: Exit with error if writing cd image fails
    
      Obtained from:  OpenBSD c8f48d9b1ea9
      Sponsored by:   The FreeBSD Foundation
    
    * makefs: Fix cd9660 filename buffer maximum length
    
      The maximum length is 30 characters for name and extension, two
      separators (. and ;) and 5 characters for file version from 1 to 32767,
      which is 37 characters.  Add one for the null term as we treat these
      buffers as C strings.
    
      This is not an issue in practice, as the file version is always 1 in
      makefs.
    
      While here, drop `_WITH_PADDING` from the macro name and update the
      previously-unused ISO_FILENAME_MAXLENGTH for the corrected length.
      A 0x00 padding byte is used by ISO9660 when needed for alignment, which
      can be the null byte at the end of the string.
    
      Use sizeof where appropriate.
    
      Reviewed by:    kevans
      Sponsored by:   The FreeBSD Foundation
      Differential Revision: https://reviews.freebsd.org/D48193
    
    * makefs: Fix cd9660 duplicate directory names
    
      Previously we could create cd9660 images with duplicate short (level 2)
      names.
    
      cd9660_level2_convert_filename used a 30-character limit (for files and
      directories), not including the '.' separator.  cd9660_rename_filename
      used a 31-character limit, including the '.'.  Directory names 31
      characters or longer (without '.') were shortened to 30 characters, and
      if a collision occurred cd9660_rename_filename uniquified them starting
      with the 31st character.  Unfortunately the directory record's name_len
      was already set, so the unique part of the name was stripped off.
    
      Directories are up to 31 d-characters (i.e., A-Z 0-9 and _); there is no
      provision for a '.' in a directory name.  Increase the name length limit
      to 31 for directories, and exclude '.'s.
    
      This name mapping and deduplication code is still fragile and convoluted
      and would beenfit from a more holistic effort.
    
      PR:             283238, 283112
      Reviewed by:    imp
      Sponsored by:   The FreeBSD Foundation
      Differential Revision: https://reviews.freebsd.org/D48251

Summary of changes:
 usr.sbin/makefs/cd9660.c                   | 169 ++++++++++-------------------
 usr.sbin/makefs/cd9660.h                   |  53 ++-------
 usr.sbin/makefs/cd9660/Makefile.inc        |   2 +-
 usr.sbin/makefs/cd9660/cd9660_archimedes.c | 125 ---------------------
 usr.sbin/makefs/cd9660/cd9660_archimedes.h |  52 ---------
 usr.sbin/makefs/cd9660/cd9660_conversion.c |   5 +-
 usr.sbin/makefs/cd9660/cd9660_debug.c      | 141 +++++++++---------------
 usr.sbin/makefs/cd9660/cd9660_eltorito.c   |  50 +++++----
 usr.sbin/makefs/cd9660/cd9660_eltorito.h   |   4 +-
 usr.sbin/makefs/cd9660/cd9660_strings.c    |   8 +-
 usr.sbin/makefs/cd9660/cd9660_write.c      |  11 +-
 usr.sbin/makefs/cd9660/iso9660_rrip.c      |  37 +++----
 usr.sbin/makefs/cd9660/iso9660_rrip.h      |  26 ++---
 usr.sbin/makefs/makefs.8                   |  48 +++++---
 14 files changed, 225 insertions(+), 506 deletions(-)
 delete mode 100644 usr.sbin/makefs/cd9660/cd9660_archimedes.c
 delete mode 100644 usr.sbin/makefs/cd9660/cd9660_archimedes.h

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/4834b23f9cda141ba3d94f2ecc1e9388aba1ac55


-- 
DragonFly BSD source repository


More information about the Commits mailing list