Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mtools should use python3 in shebangs #761

Closed
p-mongo opened this issue Dec 31, 2019 · 0 comments
Closed

mtools should use python3 in shebangs #761

p-mongo opened this issue Dec 31, 2019 · 0 comments
Assignees
Milestone

Comments

@p-mongo
Copy link
Contributor

p-mongo commented Dec 31, 2019

Current version of mtools (specifically, mlaunch) requires python 3 and does not work on python 2. However, it retains the /usr/bin/env python shebang lines.

This is causing problems on systems where the default python is python 2. In these cases mtools installs but with an exception as follows:

[2019/12/30 16:11:47.683] + mlaunch --dir /data/mci/d1c82ce78a6313e78ba96cd703415531/src/../drivers-tools/.evergreen/orchestration/db --binarypath /data/mci/d1c82ce78a6313e78ba96cd703415531/src/../drivers-tools/.evergreen/orchestration/mdb/mongodb-linux-x86_64-enterprise-ubuntu1404-4.0.9/bin --single --sslMode requireSSL --sslPEMKeyFile spec/support/certificates/server-second-level-bundle.pem --sslCAFile spec/support/certificates/ca.crt --sslClientCertificate spec/support/certificates/client.pem
[2019/12/30 16:11:47.694] Traceback (most recent call last):
[2019/12/30 16:11:47.694]   File "/data/mci/d1c82ce78a6313e78ba96cd703415531/src/../drivers-tools/.evergreen/orchestration/python/bin/mlaunch", line 5, in 
[2019/12/30 16:11:47.694]     from mtools.mlaunch.mlaunch import main
[2019/12/30 16:11:47.694]   File "/data/mci/d1c82ce78a6313e78ba96cd703415531/drivers-tools/.evergreen/orchestration/python/mtools/mlaunch/mlaunch.py", line 1541
[2019/12/30 16:11:47.694]     result.append(f'"{arg}"')
[2019/12/30 16:11:47.694]                            ^
[2019/12/30 16:11:47.694] SyntaxError: invalid syntax
[2019/12/30 16:11:47.696] Command failed: command encountered problem: error waiting on process 'c0de4964-271f-4412-91b7-ee8acaa83f4d': exit status 1

https://www.python.org/dev/peps/pep-0394/ discusses the behavior of the "python" command. According to my reading, this pep does not prescribe or recommend any particular behavior of this command.

It is my understanding that python3 is available if python 3 is installed. As far as I can recall, all python 3 installations I worked with provided a python3 binary. Therefore it should be safe to change shebang lines in mtools to specify python3 rather than python, which would make mtools work on systems that provide python 2 as the default python.

Expected behavior

mlaunch works

Actual/current behavior

mlaunch does not work because it is run with python 2 interpreter

Steps to reproduce the actual/current behavior

Use mlaunch on Evergreen

Environment

Software Version
mtools 1.6.0
MongoDB server any
Operating system Linux
@stennie stennie self-assigned this Dec 31, 2019
@stennie stennie added this to the 1.6.1 milestone Dec 31, 2019
stennie added a commit to stennie/mtools that referenced this issue Dec 31, 2019
@stennie stennie closed this as completed in f7106cb Jan 2, 2020
bugre added a commit to bugre/mtools that referenced this issue Jan 5, 2020
…_JSONSerialize_crash_w_bytes

* 'develop' of github.com:bugre/mtools:
  Add VSCode config to .gitignore
  Bump dev version
  Update for 1.6.1 release
  Fix Flake8 complaints
  Fix rueckstiess#765: mloginfo --clients: more robust parsing of client metadata (rueckstiess#766)
  Fix rueckstiess#761: mtools should use python3 in shebangs
  Fix rueckstiess#698: Add rounding option for mloginfo --queries (rueckstiess#758)
  More specific match for checkpoint duration log line
  Fix rueckstiess#258: Add timezone to mloginfo summary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants