localstack / localstack/awscli-local
segfault caused by os.execvpe in windows
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 1.3k
- フォーク
- 94
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
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.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、Windows 11 で awslocal --help を使って失敗を再現し、os.execvpe を呼び出している entry point のパスを調査します。その動作を、提案されている subprocess.run アプローチおよび PowerShell または cmd での .bat 起動パスと比較します。Windows 上で CLI が segfault せず、entry point が意図した環境で実行されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- aws, python
- 領域
- cli, operating-systems
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 35/100