[parted-devel] reproducible output

Steffen Dettmer steffen.dettmer at gmail.com
Thu Jun 6 11:17:54 BST 2019


Hi,

for an embedded system I'd like to use parted to create a disk image
using a command like

  parted -s -a optimal $imgname mklabel msdos mkpart primary ext2 0% 100%

followed by some "mke2fs $opts -d config_root_fs/ $loop".

I would like to have reproducible (or "stable" or "cachable") output,
that means if I create the disk image again with exactly the same
input options, then I'd like to get exactly the same output, that
means for example its SHA1 sum remains the same.

Unfortunately already "mklabel msdos" prevents this. If I looked
correctly this seems to be intentional:

./libparted/labels/dos.c around line 1295 in function

  static int
  msdos_write (const PedDisk* disk)
  {
    ....
   /* If there is no unique identifier, generate a random one */
   if (!table->mbr_signature)
      table->mbr_signature = generate_random_uint32 ();

As I understand the code there is no way to set or force a specific
signature, so it always is a random value.

Why is a random value needed?

Wouldn't it be better to create reproducible output by default?

Probably there are more places (GUID in filesystem and such), so
probably it makes no sense to write a patch for "mklabel msdos", what
do you think?

Are are alternative approachs to my usecase (creating reproducible
binaries) -- or is  this considered "wrong"?

Any hints appreciated!

Steffen



More information about the parted-devel mailing list