Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yurii Monakov <monakov.y@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [1/1] fs/cpio: sort 'find' utility output (reproducible builds)
Date: Mon, 29 Jun 2020 15:37:01 +0300	[thread overview]
Message-ID: <20200629153701.7c2c5ca4@monakov-y.xu> (raw)

Order of find utility results are not sorted and depend on items
attributes, so cpio produces different results across machines.

This patch sorts find output before piping to cpio to make
builds reproducible.

Signed-off-by: Yurii Monakov <monakov.y@gmail.com>
---
 fs/cpio/cpio.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cpio/cpio.mk b/fs/cpio/cpio.mk
index 28a435dd5e..73837ddecb 100644
--- a/fs/cpio/cpio.mk
+++ b/fs/cpio/cpio.mk
@@ -37,7 +37,7 @@ ROOTFS_CPIO_OPTS += --reproducible
 endif
 
 define ROOTFS_CPIO_CMD
-	cd $(TARGET_DIR) && find . | cpio $(ROOTFS_CPIO_OPTS) --quiet -o -H newc > $@
+	cd $(TARGET_DIR) && find . | sort | cpio $(ROOTFS_CPIO_OPTS) --quiet -o -H newc > $@
 endef
 
 ifeq ($(BR2_TARGET_ROOTFS_CPIO_UIMAGE),y)
-- 
2.17.1

             reply	other threads:[~2020-06-29 12:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29 12:37 Yurii Monakov [this message]
2020-06-29 16:05 ` [Buildroot] [1/1] fs/cpio: sort 'find' utility output (reproducible builds) Yann E. MORIN
2020-06-29 17:23   ` Yurii Monakov
2020-07-16 16:33 ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200629153701.7c2c5ca4@monakov-y.xu \
    --to=monakov.y@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox