diff options
author | Rob Landley <rob@landley.net> | 2021-07-11 05:02:32 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2021-07-11 05:02:32 -0500 |
commit | b1c071ee037b79e7058ebc03f6ca8536e52dc843 (patch) | |
tree | 813eda1b2e9cd7255777b8f2dfaf1aa13425e3fe /toys | |
parent | 127cff38809ea6c3a37ed3ce7f428cafdc38e2e1 (diff) | |
download | toybox-b1c071ee037b79e7058ebc03f6ca8536e52dc843.tar.gz |
Add options for reproducibility tests.
Diffstat (limited to 'toys')
-rw-r--r-- | toys/posix/cpio.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/toys/posix/cpio.c b/toys/posix/cpio.c index 35b74b3b..5ecd56df 100644 --- a/toys/posix/cpio.c +++ b/toys/posix/cpio.c @@ -16,7 +16,7 @@ * * todo: export/import linux file list text format ala gen_initramfs_list.sh -USE_CPIO(NEWTOY(cpio, "(quiet)(no-preserve-owner)md(make-directories)uH:p|i|t|F:v(verbose)o|[!pio][!pot][!pF]", TOYFLAG_BIN)) +USE_CPIO(NEWTOY(cpio, "(ignore-devno)(renumber-inodes)(quiet)(no-preserve-owner)md(make-directories)uH:p|i|t|F:v(verbose)o|[!pio][!pot][!pF]", TOYFLAG_BIN)) config CPIO bool "cpio" @@ -243,6 +243,7 @@ void cpio_main(void) } else { char *name = 0; size_t size = 0; + unsigned inode = 0; for (;;) { struct stat st; @@ -269,6 +270,8 @@ void cpio_main(void) if (!S_ISREG(st.st_mode) && !S_ISLNK(st.st_mode)) st.st_size = 0; if (st.st_size >> 32) perror_msg("skipping >2G file '%s'", name); else { + if (FLAG(renumber_inodes)) st.st_ino = ++inode; + if (FLAG(ignore_devno)) st.st_rdev = 0; llen = sprintf(toybuf, "070701%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X", (int)st.st_ino, st.st_mode, st.st_uid, st.st_gid, (int)st.st_nlink, |