Bug 210463

Summary: release build; makefs: error: The Disk Label must be at most 32 characters long
Product: Base System Reporter: Rick Miller <vmiller>
Component: miscAssignee: FreeBSD Release Engineering <re>
Status: Open ---    
Severity: Affects Only Me CC: emaste, farrokhi
Priority: --- Keywords: patch
Version: 12.0-STABLE   
Hardware: amd64   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221854
Attachments:
Description Flags
Patch truncates LABEL to 32 characters thus preventing the stop error described in the bug report none

Description Rick Miller 2016-06-22 13:15:58 UTC
Created attachment 171673 [details]
Patch truncates LABEL to 32 characters thus preventing the stop error described in the bug report

My private FreeBSD distribution modifies newvers.sh implementing a custom version scheme used internally to allow engineers to quickly discern what version of the FreeBSD OS is installed.  This modification often leads to VOLUME_LABEL and LABEL being a size greater than 32 characters during release builds.

Performing a release build via release/release.sh where these environment variables are often greater than 32 characters in this scenario produces a stop error at the end of the release.sh process when generating the UEFI disk image as observed below:

sh /usr/src/release/amd64/mkisoimages-uefi.sh -b 10_3_RELEASE_p3_CUSTM_0_amd64_UEFICD  uefi-disc1.iso disc1
200+0 records in
200+0 records out
819200 bytes transferred in 0.002648 secs (309379960 bytes/sec)
newfs_msdos: cannot get number of sectors per track: Operation not supported
newfs_msdos: cannot get number of heads: Operation not supported
newfs_msdos: trim 25 sectors to adjust to a multiple of 63
/dev/md0: 1532 sectors in 1532 FAT12 clusters (512 bytes/cluster)
BytesPerSec=512 SecPerClust=1 ResSectors=1 FATs=2 RootDirEnts=512 Sectors=1575 Media=0xf8 FATsecs=5 SecPerTrack=63 Heads=1 HiddenSecs=0
makefs: error: The Disk Label must be at most 32 characters long
usage: makefs [-t fs-type] [-o fs-options] [-d debug-mask] [-B endian]
	[-S sector-size] [-M minimum-size] [-m maximum-size] [-R roundup-size]
	[-s image-size] [-b free-blocks] [-f free-files] [-F mtree-specfile]
	[-xZ] [-N userdb-dir] image-file directory | manifest [extra-directory ...]
sh /usr/src/release/amd64/mkisoimages-uefi.sh -b 10_3_RELEASE_p3_CUSTM_0_amd64_UEFIBO  uefi-bootonly.iso bootonly
200+0 records in
200+0 records out
819200 bytes transferred in 0.002599 secs (315198040 bytes/sec)
newfs_msdos: cannot get number of sectors per track: Operation not supported
newfs_msdos: cannot get number of heads: Operation not supported
newfs_msdos: trim 25 sectors to adjust to a multiple of 63
/dev/md0: 1532 sectors in 1532 FAT12 clusters (512 bytes/cluster)
BytesPerSec=512 SecPerClust=1 ResSectors=1 FATs=2 RootDirEnts=512 Sectors=1575 Media=0xf8 FATsecs=5 SecPerTrack=63 Heads=1 HiddenSecs=0
makefs: error: The Disk Label must be at most 32 characters long
usage: makefs [-t fs-type] [-o fs-options] [-d debug-mask] [-B endian]
	[-S sector-size] [-M minimum-size] [-m maximum-size] [-R roundup-size]
	[-s image-size] [-b free-blocks] [-f free-files] [-F mtree-specfile]
	[-xZ] [-N userdb-dir] image-file directory | manifest [extra-directory ...]
make -C /usr/src/release  release-done
touch release
true
mkdir -p /R
cp -a ftp /R/
cp -p disc1.iso /R/FreeBSD-10.3-RELEASE-p3-VRSN-0-amd64-disc1.iso
cp -p bootonly.iso /R/FreeBSD-10.3-RELEASE-p3-VRSN-0-amd64-bootonly.iso
cp -p memstick.img /R/FreeBSD-10.3-RELEASE-p3-VRSN-0-amd64-memstick.img
cp -p mini-memstick.img /R/FreeBSD-10.3-RELEASE-p3-VRSN-0-amd64-mini-memstick.img
cp -p uefi-memstick.img /R/FreeBSD-10.3-RELEASE-p3-VRSN-0-amd64-uefi-memstick.img
cp -p uefi-mini-memstick.img /R/FreeBSD-10.3-RELEASE-p3-VRSN-0-amd64-uefi-mini-memstick.img
cp -p uefi-disc1.iso /R/FreeBSD-10.3-RELEASE-p3-VRSN-0-amd64-uefi-disc1.iso
cp: uefi-disc1.iso: No such file or directory
*** Error code 1

Stop.
make: stopped in /usr/src/release

The attached patch, applied to mkisoimages-uefi.sh, truncates LABEL to 32 characters thus preventing the stop error.
Comment 1 Glen Barber freebsd_committer freebsd_triage 2016-07-03 00:30:19 UTC
I think this is a reasonable approach, but would like to think about this a bit more.

I'm going to commit your patch, with one change - changing '32' to '31', as there is an off-by-one problem, and we cannot use '0' as the first value to '-c'.

gjb@nucleus:~ % echo 10.0-RELEASE-amd64-uefi-disc1.iso | cut -c 1-32 | wc -c
      33
gjb@nucleus:~ % echo 10.0-RELEASE-amd64-uefi-disc1.iso | cut -c 1-31 | wc -c
      32

Thank you for the patch.
Comment 2 commit-hook freebsd_committer freebsd_triage 2016-07-03 00:32:19 UTC
A commit references this bug:

Author: gjb
Date: Sun Jul  3 00:31:33 UTC 2016
New revision: 302318
URL: https://svnweb.freebsd.org/changeset/base/302318

Log:
  Limit VOLUME_LABEL (first argument to the mkisoimages scripts)
  to 32 characters.

  This is a direct commit to stable/10, as UEFI support natively
  exists for 11.0-CURRENT and unsupported in 9-STABLE.

  Submitted by:	Rick Miller
  PR:		210463
  Sponsored by:	The FreeBSD Foundation

Changes:
  stable/10/release/amd64/mkisoimages-uefi.sh
Comment 3 Glen Barber freebsd_committer freebsd_triage 2016-07-03 00:33:09 UTC
Thank you, Rick.
Comment 4 Babak Farrokhi freebsd_committer freebsd_triage 2018-12-04 15:02:27 UTC
I would like to reopen this PR and suggest this change for the mkisoimages.sh as well.
Comment 5 Ed Maste freebsd_committer freebsd_triage 2023-04-18 17:45:07 UTC
(In reply to Babak Farrokhi from comment #4)
Yes, mkisoimages-uefi.sh no longer exists and an equivalent change is needed in mkisoimages.sh