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

bug: asdf breaks python scripts invoked by sudo #1831

Open
cg505 opened this issue Dec 31, 2024 · 0 comments
Open

bug: asdf breaks python scripts invoked by sudo #1831

cg505 opened this issue Dec 31, 2024 · 0 comments
Labels

Comments

@cg505
Copy link

cg505 commented Dec 31, 2024

Describe the Bug

I am trying to use sudo with a python script installed in /usr/bin. In my case, the script is called ukify. /usr/bin/ukify has the shebang #!/usr/bin/env python3. If I run sudo ukify, I get the following error:

unknown command: python3. Perhaps you have to reshim?

Running python3 or /usr/bin/env python3 without sudo works fine and correctly uses the system python. Running sudo python3 or sudo /usr/bin/env python3 reproduces the issue.

You can work around the issue by using sudo -E, but this is is non-obvious and confusing. It shouldn't be necessary.

This is the same as #1213, which was incorrectly closed.

Steps to Reproduce

  1. asdf local python system
  2. sudo ukify

Expected Behaviour

unknown command: python3. Perhaps you have to reshim?

Actual Behaviour

ukify works normally

Environment

~ ❯ asdf info
OS:
Linux beacon 6.12.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 27 Dec 2024 14:24:37 +0000 x86_64 GNU/Linux

SHELL:
fish, version 3.7.1

BASH VERSION:
5.2.37(1)-release

ASDF VERSION:
v0.14.1

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/home/cooperc/.asdf
ASDF_DIR=/opt/asdf-vm
ASDF_CONFIG_FILE=/home/cooperc/.asdfrc

ASDF INSTALLED PLUGINS:
python                       https://github.com/danhper/asdf-python.git master 7b0af87

~ ❯ sudo asdf info
OS:
Linux beacon 6.12.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 27 Dec 2024 14:24:37 +0000 x86_64 GNU/Linux

SHELL:
GNU bash, version 5.2.37(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

BASH VERSION:
5.2.37(1)-release

ASDF VERSION:
v0.14.1

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/root/.asdf
ASDF_DIR=/opt/asdf-vm
ASDF_CONFIG_FILE=/root/.asdfrc

No plugins installed
ASDF INSTALLED PLUGINS:


~ ❯ sudo -E asdf info
OS:
Linux beacon 6.12.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 27 Dec 2024 14:24:37 +0000 x86_64 GNU/Linux

SHELL:
fish, version 3.7.1

BASH VERSION:
5.2.37(1)-release

ASDF VERSION:
v0.14.1

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/home/cooperc/.asdf
ASDF_DIR=/opt/asdf-vm
ASDF_CONFIG_FILE=/home/cooperc/.asdfrc

ASDF INSTALLED PLUGINS:
python                       https://github.com/danhper/asdf-python.git master 7b0af87

asdf plugins affected (if relevant)

python

@cg505 cg505 added the bug label Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant