From 16479e8eeb2fd79de4d1a78ee4ee23eead5cf3b2 Mon Sep 17 00:00:00 2001 From: Tim Keegan Date: Fri, 8 May 2026 11:44:42 +1200 Subject: [PATCH] fix: Failing sandbox test on macOS On macOS, python-build-standalone (used by hatch/uv) embeds @executable_path/../lib/libpythonX.Y.dylib. When EnvBuilder copies the binary into a new venv, @executable_path resolves to the venv's bin/ directory where the dylib is absent, causing dyld to abort. Using symlinks instead lets macOS resolve the reference back to the original installation. --- RELEASE-NOTES.md | 1 + src/snowflake/cli/_plugins/nativeapp/codegen/sandbox.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 927d451fbc..2a37341b0d 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -21,6 +21,7 @@ ## New additions ## Fixes and improvements +* Fixed `SandboxEnvBuilder` failing with `SIGABRT` on macOS when creating a codegen sandbox virtual environment. On macOS, `python-build-standalone` (used by hatch and uv) embeds a `@executable_path`-relative reference to `libpython`; copying the binary into the venv breaks dyld resolution. The venv is now created with symlinks on macOS so the dynamic linker can resolve the library from its original location. # v3.17.0 diff --git a/src/snowflake/cli/_plugins/nativeapp/codegen/sandbox.py b/src/snowflake/cli/_plugins/nativeapp/codegen/sandbox.py index 91827a3f75..fd32eb0812 100644 --- a/src/snowflake/cli/_plugins/nativeapp/codegen/sandbox.py +++ b/src/snowflake/cli/_plugins/nativeapp/codegen/sandbox.py @@ -259,6 +259,10 @@ def __init__(self, path: Path, **kwargs) -> None: Parameters: path (Path): The directory in which the sandbox environment will be created. """ + # On macOS, python-build-standalone (used by hatch/uv) embeds + # @executable_path/../lib/libpythonX.Y.dylib. Copying the binary into the venv + # breaks dyld resolution; symlinking lets macOS resolve it to the original location. + kwargs.setdefault("symlinks", sys.platform == "darwin") super().__init__(**kwargs) self.path = path self._context: Any = None # cached context