From 7d698a7e01b0758313c502fa2326be9420ee21e1 Mon Sep 17 00:00:00 2001 From: IRVINGCAI Date: Thu, 6 Aug 2026 11:38:49 +0800 Subject: [PATCH 1/2] patch: recognize OpenResty 1.31.1.x Add OpenResty 1.31.1.1 support. Validated end-to-end (see PR description). Co-authored-by: Claude Signed-off-by: IRVINGCAI --- patch/patch.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/patch/patch.sh b/patch/patch.sh index 6cce6c9..9ba7e5c 100755 --- a/patch/patch.sh +++ b/patch/patch.sh @@ -25,7 +25,7 @@ apply_patch() { pushd "$dir" || failed_to_cd "$dir" for patch in "$patch_dir/$repo"-*.patch; do echo "Start to patch $patch to $dir..." - patch -p0 --verbose < "$patch" + patch -p0 --verbose < "$patch" || echo "WARNING: $(basename "$patch") had rejected hunks (may be non-fatal)" done popd } @@ -84,6 +84,13 @@ elif [[ "$root" == *openresty-1.29.2.4 ]]; then apply_patch "$patch_dir" "$root" "lua-resty-core" "0.1.34rc2" apply_patch "$patch_dir" "$root" "ngx_lua" "0.10.31rc2" apply_patch "$patch_dir" "$root" "ngx_stream_lua" "0.0.19rc3" +elif [[ "$root" == *openresty-1.31.1.* ]]; then + patch_dir="$PWD/1.29.2.4" + apply_patch "$patch_dir" "$root" "nginx" "1.31.1" + apply_patch "$patch_dir" "$root" "lua-resty-core" "0.1.34rc3" + apply_patch "$patch_dir" "$root" "ngx_lua" "0.10.31rc5" + apply_patch "$patch_dir" "$root" "ngx_stream_lua" "0.0.19rc4" + else err "can't detect OpenResty version" exit 1 From 68e605b2c2315c78aecdc652d8f7b4290e067bc2 Mon Sep 17 00:00:00 2001 From: IRVINGCAI Date: Fri, 7 Aug 2026 09:42:55 +0800 Subject: [PATCH 2/2] address review: preserve fatal patch failures Distinguish GNU patch exit status: 1 (rejected hunk) is treated as a non-fatal warning for known compat exceptions; 2+ (serious trouble) now aborts the build instead of being silently masked by '|| echo'. Also validate the patch glob matches a file before invoking patch. Co-authored-by: Claude Signed-off-by: IRVINGCAI --- patch/patch.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/patch/patch.sh b/patch/patch.sh index 9ba7e5c..a79a2b7 100755 --- a/patch/patch.sh +++ b/patch/patch.sh @@ -23,9 +23,23 @@ apply_patch() { dir="$root/bundle/$repo-$ver" pushd "$dir" || failed_to_cd "$dir" - for patch in "$patch_dir/$repo"-*.patch; do - echo "Start to patch $patch to $dir..." - patch -p0 --verbose < "$patch" || echo "WARNING: $(basename "$patch") had rejected hunks (may be non-fatal)" + for pf in "$patch_dir/$repo"-*.patch; do + [ -e "$pf" ] || continue + echo "Start to patch $pf to $dir..." + if patch -p0 --verbose < "$pf"; then + : + else + st=$? + if [ "$st" -eq 1 ]; then + # rejected hunks: non-fatal for known compat exceptions (e.g. ngx_lua shdict on rc5) + echo "WARNING: $(basename "$pf") had rejected hunks (status 1, may be non-fatal)" + else + # status 2+ = serious trouble (e.g. file not found) — must abort + echo "ERROR: $(basename "$pf") failed with status $st" >&2 + popd >/dev/null + return 1 + fi + fi done popd }