mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-23 22:11:45 -05:00
fix: correct windows python audit format (#17697)
This commit is contained in:
1 parent
49b84637ee
commit
84f199cb04
4 files changed
+114
No files matched your search
@@ -0,0 +1,11 @@
|
||||
--- a/Modules/_winapi.c
|
||||
+++ b/Modules/_winapi.c
|
||||
@@ -1252,7 +1252,7 @@ _winapi_CreateProcess_impl(PyObject *module, const Py_UNICODE *application_name,
|
||||
wchar_t *command_line_copy = NULL;
|
||||
AttributeList attribute_list = {0};
|
||||
|
||||
- if (PySys_Audit("_winapi.CreateProcess", "uuu", application_name,
|
||||
+ if (PySys_Audit("_winapi.CreateProcess", "uOu", application_name,
|
||||
command_line, current_directory) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
# Applied as PATCH_COMMAND for CPython on Windows, from the extracted source directory.
|
||||
#
|
||||
# CPython 3.12.13 raises the _winapi.CreateProcess audit event with PySys_Audit format "uuu",
|
||||
# although command_line is a Python object: audit hooks receive garbage instead of the command
|
||||
# line. PluginAuditManager turns that argument into a process grant's target, so the prompt
|
||||
# named the wrong executable and the grant it saved could not cover a real call. The patch
|
||||
# changes the format to "uOu", as upstream does (python/cpython#159237), until the pinned
|
||||
# CPython release carries the fix.
|
||||
#
|
||||
# Applying is idempotent: ExternalProject re-runs the patch step when PATCH_COMMAND changes or
|
||||
# the patch stamp is missing, which can happen on a source tree that already carries the patch.
|
||||
# A reverse check recognises that state instead of failing the build on an already patched file.
|
||||
# When the pinned CPython release carries the fix, drop this script, its patch and PATCH_COMMAND.
|
||||
|
||||
set(_patch "${CMAKE_CURRENT_LIST_DIR}/0001-winapi-createprocess-audit-format.patch")
|
||||
|
||||
if(NOT GIT_EXECUTABLE)
|
||||
message(FATAL_ERROR "GIT_EXECUTABLE is required")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" apply --check --reverse --ignore-space-change "${_patch}"
|
||||
RESULT_VARIABLE _already_applied
|
||||
OUTPUT_QUIET
|
||||
ERROR_QUIET
|
||||
)
|
||||
if(_already_applied EQUAL 0)
|
||||
message(STATUS "CPython: _winapi.CreateProcess audit format is already patched")
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" apply --verbose --ignore-space-change --whitespace=fix "${_patch}"
|
||||
RESULT_VARIABLE _apply_result
|
||||
)
|
||||
if(NOT _apply_result EQUAL 0)
|
||||
message(FATAL_ERROR "CPython: failed to apply ${_patch} (exit ${_apply_result})")
|
||||
endif()
|
||||
Vendored
+11
@@ -181,6 +181,16 @@ if(WIN32)
|
||||
-DPYTHON_LAYOUT_ARCH=${_python_layout_arch}
|
||||
-P ${CMAKE_CURRENT_LIST_DIR}/stage_windows.cmake
|
||||
)
|
||||
# CPython 3.12.13 raises the _winapi.CreateProcess audit event with PySys_Audit's "u" format
|
||||
# for command_line although it is a Python object, so audit hooks received garbage instead of
|
||||
# the command line and the plugin audit prompt named the wrong executable. Apply upstream's
|
||||
# "uOu" fix (python/cpython#159237) until the pinned release carries it. The step tolerates
|
||||
# an already patched tree, which a re-run after a stamp change can meet.
|
||||
set(_python_patch_cmd
|
||||
${CMAKE_COMMAND}
|
||||
"-DGIT_EXECUTABLE=${GIT_EXECUTABLE}"
|
||||
-P "${CMAKE_CURRENT_LIST_DIR}/patch_winapi_audit.cmake"
|
||||
)
|
||||
elseif(APPLE)
|
||||
# macOS configuration
|
||||
if(CMAKE_OSX_ARCHITECTURES)
|
||||
@@ -351,6 +361,7 @@ ExternalProject_Add(dep_python3
|
||||
URL_HASH SHA256=${_python_sha256}
|
||||
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/python3
|
||||
BUILD_IN_SOURCE ON
|
||||
PATCH_COMMAND ${_python_patch_cmd}
|
||||
CONFIGURE_COMMAND ${_conf_cmd}
|
||||
BUILD_COMMAND ${_build_cmd}
|
||||
INSTALL_COMMAND ${_install_cmd}
|
||||
|
||||
Reference in new issue
Block a user