]> code.ossystems Code Review - openembedded-core.git/commit
classes/reproducible_build: Use atomic rename for SDE file
authorJoshua Watt <JPEWhacker@gmail.com>
Wed, 2 Jun 2021 02:36:48 +0000 (21:36 -0500)
committerAnuj Mittal <anuj.mittal@intel.com>
Thu, 10 Jun 2021 06:57:07 +0000 (14:57 +0800)
commit8b2fd4e5e0841b81b4f709b061b655e2266dd4da
tree4dbaf2d5053757a3315417d52adf201abf1381d3
parent79ec1d73a107277586d3d8e9c0d46dfc0ac2b0d8
classes/reproducible_build: Use atomic rename for SDE file

If an existing source date epoch file was found during do_unpack, it was
deleted and a new one would be written in its place. This causes a race
with check-before-use code in get_source_date_epoch_value. Resolve the
problem by making do_unpack write the new source date epoch to a
temporary file, then do an atomic rename to ensure it's always present,
and change the check-before-use code to use a EAFP exception instead of
checking for file existence.

[YOCTO #14384]

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 0b5e3b33187bf78a2d62cc886463e4b27d6bd228)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
meta/classes/reproducible_build.bbclass