localstack / localstack/awscli-local
segfault caused by os.execvpe in windows
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 1.3k
- Fork
- 94
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I'm using windows 11 and os.execvpe will cause a segfault. I happen to be using gitbash and pipx, but I get the same behavior if I don't use pipx.
After a bit of hacking, I got this to work, but with 2 second additional time cost over using aws directly. I see that 9 month ago execvpe was introduced probably to make things better for linux or mac users
I'm guessing you don't have access to a windows machine, you might want to consider a github action on a windows image to check to see if awslocal --help can run without segfault.
Another possibility is to use something like shellingham to detect the shell before doing things that the OS isn't expected to be able to do.
def run(cmd, env=None):
"""
Replaces this process with the AWS CLI process, with the given command and environment
"""
# if not env:
# env = {}
# print("os.execvpe")
# os.execvpe(cmd[0], cmd, env)
if env is None:
env = os.environ.copy()
else:
# Make sure we include the current environment to avoid missing essential variables
full_env = os.environ.copy()
full_env.update(env)
print("subprocess.run")
result = subprocess.run(cmd, env=full_env, text=True, capture_output=True)
print(result.stdout) # Print standard output
print(result.stderr, file=sys.stderr) # Print standard error to the error stream
return result
When I use powershell or cmd, I get "ModuleNotFoundError: No module named 'boto3'", probably because the .bat file gets launched and doesn't actual activate the right environment, but I also got that even when installing to the system python (which is a no-no). I didn't pursue why the entry point scripts fail to get an activated environment, since I never use powershell or cmd.exe.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo il malfunzionamento su Windows 11 con awslocal --help e ispeziona il percorso dell’entry point che chiama os.execvpe. Confronta questo comportamento con l’approccio proposto con subprocess.run e con il percorso di avvio .bat in PowerShell o cmd. Il lavoro è completato quando la CLI non va più in segmentation fault su Windows e il suo entry point viene eseguito nell’ambiente previsto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- aws, python
- Ambito
- cli, operating-systems
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 35/100