[Bug 253764] mkimg does not allocate space for partitions when given an absolute offset

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Feb 22 14:58:45 UTC 2021


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253764

            Bug ID: 253764
           Summary: mkimg does not allocate space for partitions when
                    given an absolute offset
           Product: Base System
           Version: 11.4-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: ardovm at yahoo.it

When mkimg(1) is asked to output a partition of a given size with a given
absolute offset into a raw image, it does not size the output file properly.

When no offset is given, the file is sized correctly:
$ mkimg -f raw -o temp.img -s mbr -p freebsd::512000
creates a file that is 1001 blocks long.

Relative offsets work well:
$ mkimg -f raw -o temp.img -s mbr -p freebsd::512000:+512
creates a file that is 1002 blocks long.

But:
$ mkimg -f raw -o temp.img -s mbr -p freebsd::512000:512
creates a file that is only 1 block long, instead of 1001.

Looking at the code, in file mkimg.c the problem seems to be that the "block"
variable is not updated with the partition size. But I could not understand the
code well enough to propose a patch, unfortunately.

Additional info:

$ uname -a
FreeBSD myhost 11.4-STABLE FreeBSD 11.4-STABLE #1 r369279: Tue Feb 16 10:16:53
CET 2021     root at myhost:/usr/obj/usr/src/sys/GENERIC  amd64

$ svn info /usr/src/usr.bin/mkimg | grep Revision
Revision: 369279

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


More information about the freebsd-bugs mailing list