From caf37bdceca49df8a819859057060ab7db6f3612 Mon Sep 17 00:00:00 2001 From: Saikari Date: Mon, 16 Feb 2026 00:35:32 +0300 Subject: enhance signature check for gcc.exe to handle both absolute and relative paths --- .../modules/import/lib/detect/find_program.lua | 26 +++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua index 9f1815f38..6233738f6 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua @@ -42,9 +42,29 @@ function sandbox_lib_detect_find_program._do_check(program, opt) -- avoid gcc.exe signed by GIGA-BYTE if winos.file_signature and program:lower():endswith("gcc.exe") then - local signer = winos.file_signature(program) - if signer and signer.signer_name and signer.signer_name:startswith("GIGA-BYTE") then - return false + local check_signature = function (program) + if os.isfile(program) then + local signer = winos.file_signature(program) + if signer and signer.signer_name and signer.signer_name:startswith("GIGA-BYTE") then + return true + end + end + end + if path.is_absolute(program) then + if check_signature(program) then + return false + end + else + local paths = path.splitenv(vformat("$(env PATH)")) + for _, p in ipairs(paths) do + local prog = path.join(p, program) + if os.isfile(prog) then + if check_signature(prog) then + return false + end + break + end + end end end -- cgit v1.3.1