Re: [PATCH v2] kheaders: making headers archive reproducible

From: Dmitry Goldin
Date: Tue Oct 08 2019 - 05:54:54 EST


âââââââ Original Message âââââââ
On Tuesday, October 8, 2019 10:14 AM, Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx> wrote:

> On Tue, Oct 8, 2019 at 5:07 PM Dmitry Goldin dgoldin@xxxxxxxxxxxxx wrote:
>
> > Hmm. --sort was introduced in 1.28 in 2014. Do you think it would warrant some sort of version check and fallback or is this something we can expect the user to handle if their distribution happens to not ship anything more recent? A few sensible workarounds come to mind.
>
> I think the former.

After pondering it briefly, maybe substituting the option is a bit less hassle than checking for
the version and then degrading to a possibly non-reproducible archive.

Maybe we could go with something like the sketch below to replace --sort=name. That is, if
that's the only problematic flag.

find $cpio_dir -printf "%P\n" | LC_ALL=C sort | \
tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \
--owner=0 --group=0 --numeric-owner \
-Jcf $tarfile -C $cpio_dir/ -T - > /dev/null

I will look at this a bit more closely and give it a test-run later today or early tomorrow. Then we can decide if its sufficient before submitting another patch. Other suggestions and pointers are welcome, of course.

--
Best regards,
Dmitry