From 0e09712b6e67c704ea1c9fcc57d6fb0497691063 Mon Sep 17 00:00:00 2001
From: yangchenguang <yangchenguang@kylinsec.com.cn>
Date: Tue, 26 Mar 2024 10:27:35 +0800
Subject: [PATCH] fix macros autopath num error

fix: https://github.com/rpm-software-management/rpm/commit/c495d73449cb707bf8b3a0f47a67bba115c00bcf
%autopatch: Fix patch number parameters
Those where not converted to integers for to lookup though not converted
to the actual file name.

Thanks to Vít Ondruch for pointing this out, suggesting the fix and
insisting on a test case!

Resolves: #1766

Signed-off-by: yangchenguang <yangchenguang@kylinsec.com.cn>
---
 macros.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/macros.in b/macros.in
index 4dbf5b6..643b02b 100644
--- a/macros.in
+++ b/macros.in
@@ -1256,7 +1256,7 @@ for i, p in ipairs(patches) do
     bynum[patch_nums[i]] = p
 end
 for i, a in ipairs(arg) do
-    local p = bynum[a]
+    local p = bynum[tonumber(a)]
     if p then
         print(rpm.expand("%__apply_patch -m %{basename:"..p.."}  "..options..p.." "..i.."\\n"))
     else
-- 
2.39.1

