summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaikari <[email protected]>2026-02-16 00:35:32 +0300
committerSaikari <[email protected]>2026-02-16 00:35:32 +0300
commitcaf37bdceca49df8a819859057060ab7db6f3612 (patch)
tree4723477e2264481df05559a21bb646177f8383fd
parent92cbb94be2d3ce0d1a302beaf9e031d9ee47126a (diff)
enhance signature check for gcc.exe to handle both absolute and relative paths
-rw-r--r--xmake/core/sandbox/modules/import/lib/detect/find_program.lua26
1 files 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