fix: strip script dir from sys.path before imports in x/ Python scripts

Python adds the script directory to sys.path[0] at startup and tries to
create a FileFinder for it. When the script lives on a 9P FUSE mount the
FileFinder init fails before any stdlib import can succeed. sys is a
builtin and loads without filesystem access, so strip the path first.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-04-25 11:49:03 +02:00
parent b9b4a1fe1d
commit 778af112db
2 changed files with 4 additions and 2 deletions

View File

@ -7,10 +7,11 @@ for running the command outside the Landlock sandbox.
Usage: elevate -- <cmd>
"""
import sys
sys.path = sys.path[1:] # strip script dir — may be a non-navigable fs (e.g. 9P)
import json
import os
import socket
import sys
def default_socket_path():

View File

@ -15,11 +15,12 @@ Environment:
SUPERPOWERD_SOCKET override superpowerd socket path
SUPERPOWERD_SOCKET_DIR directory containing superpowerd.sock
"""
import sys
sys.path = sys.path[1:] # strip script dir — may be a non-navigable fs (e.g. 9P)
import json
import os
import signal
import socket
import sys
import threading