-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Description
Go言語においてatcoder-tools testを実行すると、以下のエラーが発生し失敗します。
(main.go自体のパーミッションは、 chmod u+x main.goにより.rwx r-x r-xの権限付与済み)
2021-12-04 00:25:10,652 INFO: Inferred exec file: ./main.go
Traceback (most recent call last):
File "/Users/user/.anyenv/envs/pyenv/versions/3.9.4/bin/atcoder-tools", line 8, in <module>
sys.exit(main())
File "/Users/user/.anyenv/envs/pyenv/versions/3.9.4/lib/python3.9/site-packages/atcodertools/atcoder_tools.py", line 64, in main
exit_program(tester_main(prog, args))
File "/Users/user/.anyenv/envs/pyenv/versions/3.9.4/lib/python3.9/site-packages/atcodertools/tools/tester.py", line 420, in main
return run_all_tests(exec_file, in_sample_file_list, out_sample_file_list, args.timeout, args.knock_out,
File "/Users/user/.anyenv/envs/pyenv/versions/3.9.4/lib/python3.9/site-packages/atcodertools/tools/tester.py", line 214, in run_all_tests
test_summary = run_for_samples(
File "/Users/user/.anyenv/envs/pyenv/versions/3.9.4/lib/python3.9/site-packages/atcodertools/tools/tester.py", line 121, in run_for_samples
exec_res = run_program(exec_file, in_sample_file,
File "/Users/user/.anyenv/envs/pyenv/versions/3.9.4/lib/python3.9/site-packages/atcodertools/executils/run_program.py", line 38, in run_program
proc = subprocess.run(
File "/Users/user/.anyenv/envs/pyenv/versions/3.9.4/lib/python3.9/subprocess.py", line 505, in run
with Popen(*popenargs, **kwargs) as process:
File "/Users/user/.anyenv/envs/pyenv/versions/3.9.4/lib/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/Users/user/.anyenv/envs/pyenv/versions/3.9.4/lib/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: './main.go'
run_program.pyにおいて subprocess.run実行時の引数にshell=Trueを指定すると、手元で正常に実行が完了します。
が、Pythonのドキュメントによると
If the shell is invoked explicitly, via shell=True, it is the application's responsibility to ensure that all whitespace and metacharacters are quoted appropriately to avoid shell injection vulnerabilities.
とのことです。
また、この箇所を変更した場合に他言語実行時への影響もありそうなため、どういった修正方針が良さそうか相談したいです。
Metadata
Metadata
Assignees
Labels
No labels