public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Quentin Perret <qperret@google.com>
To: Dmitry Goldin <dgoldin@protonmail.ch>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>,
	Andreas Schwab <schwab@linux-m68k.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	"linux-kernel\\\\\\\\@vger.kernel.org"
	<linux-kernel@vger.kernel.org>,
	"joel\\\\\\\\@joelfernandes.org" <joel@joelfernandes.org>,
	Ben Hutchings <ben@decadent.org.uk>,
	adelva@google.com, natechancellor@gmail.com, maennich@google.com
Subject: Re: [PATCH] kheaders: substituting --sort in archive creation
Date: Mon, 14 Oct 2019 14:40:37 +0100	[thread overview]
Message-ID: <20191014134037.GA79684@google.com> (raw)
In-Reply-To: <oZ31wh8h96sDGJ_uQWJbvFDzh4-ByMMeoyOhTLmfdf5B5T0KWgLhhNbC49J6EM_Nlgo_zH-bUScrWxYTgP9eNNMF1D5AbpcbIHbBuzbS_44=@protonmail.ch>

Hi Dmitry,

On Wednesday 09 Oct 2019 at 13:42:14 (+0000), Dmitry Goldin wrote:
> From: Dmitry Goldin <dgoldin+lkml@protonmail.ch>
> 
> The option --sort=ORDER was only introduced in tar 1.28 (2014), which
> is rather new and might not be available in some setups.
> 
> This patch tries to replicate the previous behaviour as closely as possible
> to fix the kheaders build for older environments. It does not produce identical
> archives compared to the previous version due to minor sorting
> differences but produces reproducible results itself in my tests.
> 
> Signed-off-by: Dmitry Goldin <dgoldin+lkml@protonmail.ch>
> ---
>  kernel/gen_kheaders.sh | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh
> index aff79e461fc9..5a0fc0b0403a 100755
> --- a/kernel/gen_kheaders.sh
> +++ b/kernel/gen_kheaders.sh
> @@ -71,10 +71,13 @@ done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1
>  find $cpio_dir -type f -print0 |
>  	xargs -0 -P8 -n1 perl -pi -e 'BEGIN {undef $/;}; s/\/\*((?!SPDX).)*?\*\///smg;'
> 
> -# Create archive and try to normalize metadata for reproducibility
> -tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \
> -    --owner=0 --group=0 --sort=name --numeric-owner \
> -    -Jcf $tarfile -C $cpio_dir/ . > /dev/null
> +# Create archive and try to normalize metadata for reproducibility.
> +# For compatibility with older versions of tar, files are fed to tar
> +# pre-sorted, as --sort=name might not be available.
> +find $cpio_dir -printf "./%P\n" | LC_ALL=C sort | \
> +    tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \
> +    --owner=0 --group=0 --numeric-owner --no-recursion \
> +    -Jcf $tarfile -C $cpio_dir/ -T - > /dev/null
> 
>  echo "$src_files_md5" >  kernel/kheaders.md5
>  echo "$obj_files_md5" >> kernel/kheaders.md5
> --
> 2.23.0

FWIW:

  Tested-by: Quentin Perret <qperret@google.com>

It turns out this issue broke something in our CI, could this patch be
queued as a -rc4 fix ?

Thanks,
Quentin

  parent reply	other threads:[~2019-10-14 13:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-09 13:42 [PATCH] kheaders: substituting --sort in archive creation Dmitry Goldin
2019-10-09 13:56 ` Dmitry Goldin
2019-10-09 17:32   ` Andreas Schwab
2019-10-14 13:40 ` Quentin Perret [this message]
2019-10-17  2:02   ` Masahiro Yamada

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=20191014134037.GA79684@google.com \
    --to=qperret@google.com \
    --cc=adelva@google.com \
    --cc=ben@decadent.org.uk \
    --cc=dgoldin@protonmail.ch \
    --cc=gregkh@linuxfoundation.org \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maennich@google.com \
    --cc=natechancellor@gmail.com \
    --cc=schwab@linux-m68k.org \
    --cc=yamada.masahiro@socionext.com \
    /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