[Bug 259012] makefs -t msdos creates broken image when out of space

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 08 Oct 2021 20:06:36 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259012

            Bug ID: 259012
           Summary: makefs -t msdos creates broken image when out of space
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: emaste@freebsd.org

I attempted to create a FAT image using:

makefs -t msdos \
    -o fat_type=16 \
    -o sectors_per_cluster=1 \
    -o volume_label=EFISYS \
    -s 64m \
    -D arm64.rootfs METALOG-boot

as it happens the content will not actually fit in 64m, and makefs emits errors
and reports that the image is not created:

makefs: warning: FAT type limits file system to 66069 sectors
arm64.rootfs: 65524 sectors in 65524 FAT16 clusters (512 bytes/cluster)
BytesPerSec=512 SecPerClust=1 ResSectors=1 FATs=2 RootDirEnts=512 Media=0xf0
FATsecs=256 SecPerTrack=63 Heads=255 HiddenSecs=0 HugeSectors=66069
Populating `arm64.rootfs'
makefs: msdosfs_mkfile ./boot/kernel/ath_hal_ar9300.ko: No space left on device
makefs: msdos_populate_dir ./boot/kernel: No space left on device
makefs: msdos_populate_dir ./boot: No space left on device
makefs: Image file `arm64.rootfs' not created.

However, an image of the requested size with truncated contents does exist at
this point:

$ ls arm64-stage/arm64.rootfs 
arm64-stage/arm64.rootfs

-- 
You are receiving this mail because:
You are the assignee for the bug.