localstack / localstack/awscli-local
segfault caused by os.execvpe in windows
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 1.3k
- Forks
- 94
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par reproduire l’échec sous Windows 11 avec awslocal --help et inspectez le chemin de l’entry point qui appelle os.execvpe. Comparez ce comportement avec l’approche subprocess.run proposée et avec le chemin de lancement .bat dans PowerShell ou cmd. C’est terminé lorsque la CLI ne provoque plus de segmentation fault sous Windows et que son entry point s’exécute dans l’environnement prévu.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- aws, python
- Domaine
- cli, operating-systems
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 35/100