On Fri, Jan 30, 2026 at 12:59:47PM -0500, Joe Lawrence wrote:
> diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build
> index 964f9ed5ee1b..5a8c592c4c15 100755
> --- a/scripts/livepatch/klp-build
> +++ b/scripts/livepatch/klp-build
> @@ -426,6 +426,8 @@ refresh_patch() {
>       local patch="$1"
>       local tmpdir="$PATCH_TMP_DIR"
>       local files=()
> +     local orig_files=()
> +     local patched_files=()
>  
>       rm -rf "$tmpdir"
>       mkdir -p "$tmpdir/a"
> @@ -434,12 +436,20 @@ refresh_patch() {
>       # Get all source files affected by the patch
>       get_patch_files "$patch" | mapfile -t files
>  
> -     # Copy orig source files to 'a'
> -     ( cd "$SRC" && echo "${files[@]}" | xargs cp --parents 
> --target-directory="$tmpdir/a" )
> +     # Copy orig source files to 'a', filter to only existing files
> +     for file in "${files[@]}"; do
> +             [[ "$file" != "dev/null" ]] && [[ -f "$SRC/$file" ]] && 
> orig_files+=("$file")

Can we fix get_patch_files() so it filters out /dev/null (or "dev/null"
as it appears to be for some reason)?  I don't think any of its callers
would want that.

Also I'm thinking these checks would be more precise if they parsed the
patch file directly to get the before/after file names, as that would
catch more cases of malformed patches.

So maybe we'd just need something like get_patch_input_files() and
get_patch_output_files() here (not sure about the naming)?

BTW, for the patch subject prefixes I've been using
"livepatch/klp-build" for changes to klp-build and "objtool/klp" for
objtool/klp-diff.c, so let's keep doing that unless anybody has any
better suggestions.

-- 
Josh

Reply via email to