Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions src/manage/scriptutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,20 @@
if cmd.shebang_can_run_anything or cmd.shebang_can_run_anything_silently:
i = _find_on_path(cmd, full_cmd)
if not cmd.shebang_can_run_anything_silently:
LOGGER.warn("A shebang '%s' was found, but could not be matched "
"to an installed runtime.", full_cmd)
LOGGER.warn("Arbitrary command was found on PATH instead. Configure "
"'shebang_can_run_anything' to disable this.")
LOGGER.warn("A shebang '%s' was found but could not be matched "

Check warning on line 90 in src/manage/scriptutils.py

View check run for this annotation

Codecov / codecov/patch

src/manage/scriptutils.py#L90

Added line #L90 was not covered by tests
"to an installed runtime, so it will be treated as "
"an arbitrary command.", full_cmd)
LOGGER.warn("To prevent execution of programs that are not "

Check warning on line 93 in src/manage/scriptutils.py

View check run for this annotation

Codecov / codecov/patch

src/manage/scriptutils.py#L93

Added line #L93 was not covered by tests
"Python runtimes, set 'shebang_can_run_anything' to "
"'false' in your configuration file.")
return i

else:
LOGGER.warn("A shebang '%s' was found, but could not be matched "
"to an installed runtime.", full_cmd)
LOGGER.warn("Arbitrary command execution is disabled. Reconfigure "
"'shebang_can_run_anything' to enable it. "
LOGGER.warn("Arbitrary command execution is disabled. Configure "

Check warning on line 101 in src/manage/scriptutils.py

View check run for this annotation

Codecov / codecov/patch

src/manage/scriptutils.py#L101

Added line #L101 was not covered by tests
"'shebang_can_run_anything' to 'true' in your "
"configuration file to enable it. "
"Launching with default runtime.")
raise LookupError

Expand All @@ -114,16 +117,19 @@
pass
if cmd.shebang_can_run_anything or cmd.shebang_can_run_anything_silently:
if not cmd.shebang_can_run_anything_silently:
LOGGER.warn("A shebang '%s' was found, but does not match any "
"supported template (e.g. '/usr/bin/python').", full_cmd)
LOGGER.warn("Using the shebang as an arbitrary command instead. "
"Configure 'shebang_can_run_anything' to disable this.")
LOGGER.warn("A shebang '%s' was found but does not match any "
"supported template (e.g. '/usr/bin/python'), so it "
"will be treated as an arbitrary command.", full_cmd)
LOGGER.warn("To prevent execution of programs that are not "
"Python runtimes, set 'shebang_can_run_anything' to "
"'false' in your configuration file.")
return _find_on_path(cmd, full_cmd)
else:
LOGGER.warn("A shebang '%s' was found, but could not be matched "
"to an installed runtime.", full_cmd)
LOGGER.warn("Arbitrary command execution is disabled. Reconfigure "
"'shebang_can_run_anything' to enable it. "
LOGGER.warn("Arbitrary command execution is disabled. Change "

Check warning on line 130 in src/manage/scriptutils.py

View check run for this annotation

Codecov / codecov/patch

src/manage/scriptutils.py#L130

Added line #L130 was not covered by tests
"'shebang_can_run_anything' to 'true' in your "
"configuration file to enable it. "
"Launching with default runtime.")
raise LookupError

Expand Down Expand Up @@ -153,7 +159,7 @@
# This involves finding '# /// script' followed by
# a line with '# requires-python = <spec>'.
# That spec needs to be processed as a version constraint, which
# is currently entirely unsupported.
# cmd.get_install_to_run() can handle.
raise LookupError(script)


Expand Down