mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-22 21:49:41 +00:00
kernel: Fix patch ordering
Fix the `build-kernel.sh` script to sort patches correctly. Previously, it relied on `find(1)` for the ordering. However, `find(1)` does not guarantee any ordering of files within a directory. Since the ordering could therefore be "random", it was quite possible for patches to be applied in the wrong order, resulting in conflicts. Fixes: #1003. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
parent
ed13991f2d
commit
93da14508f
@ -343,7 +343,20 @@ setup_kernel() {
|
|||||||
local patches_dir_for_version="${patches_path}/${major_kernel}.x"
|
local patches_dir_for_version="${patches_path}/${major_kernel}.x"
|
||||||
local kernel_patches=""
|
local kernel_patches=""
|
||||||
if [ -d "${patches_dir_for_version}" ]; then
|
if [ -d "${patches_dir_for_version}" ]; then
|
||||||
kernel_patches=$(find "${patches_dir_for_version}" -name '*.patch' -type f)
|
# Patches are expected to be named in the standard
|
||||||
|
# git-format-patch(1) format where the first part of the
|
||||||
|
# filename represents the patch ordering
|
||||||
|
# (lowest numbers apply first):
|
||||||
|
#
|
||||||
|
# "${number}-${dashed_description}"
|
||||||
|
#
|
||||||
|
# For example,
|
||||||
|
#
|
||||||
|
# 0001-fix-the-bad-thing.patch
|
||||||
|
# 0002-improve-the-fix-the-bad-thing-fix.patch
|
||||||
|
# 0003-correct-compiler-warnings.patch
|
||||||
|
kernel_patches=$(find "${patches_dir_for_version}" -name '*.patch' -type f |\
|
||||||
|
sort -t- -k1,1n)
|
||||||
else
|
else
|
||||||
info "kernel patches directory does not exit"
|
info "kernel patches directory does not exit"
|
||||||
fi
|
fi
|
||||||
|
@ -1 +1 @@
|
|||||||
71
|
72
|
||||||
|
Loading…
Reference in New Issue
Block a user