-
-
Notifications
You must be signed in to change notification settings - Fork 531
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle interpreter directives with long lengths (#794)
* venv: prepend interpreter directive to argument list When preparing virtual environments in a file container which has large length, the system might not be able to invoke shebang scripts which define interpreters beyond system limits (e.x. Linux as a limit of 128; BINPRM_BUF_SIZE [1]). This method can be used to check if the executable is a script containing a shebang line [2]. If so, extract the interpreter (and possible optional argument) and prepend the values to the provided argument list. tox will only attempt to read an interpreter directive of a maximum size of 2048 bytes to limit excessive reading and support UNIX systems which may support a longer interpret length. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/include/uapi/linux/binfmts.h?h=linux-4.16.y#n19 [2]: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/fs/binfmt_script.c?h=linux-4.16.y#n24 Signed-off-by: James Knight <james.d.knight@live.com> * tests: validate shebang interpreter prepending Providing a series of test assertions to validate the recently added method `prepend_shebang_interpreter`. Ensures shell scripts with various interpreter directives (whitespaces, single argument, invalid entries) are appended or ignored respectfully. Signed-off-by: James Knight <james.d.knight@live.com> * changelog: track pr 794 Track change which supports handling interpreter directives in environments with long path lengths [1]. [1]: e913dd3 Signed-off-by: James Knight <james.d.knight@live.com> * doc: add workaround for limited shebang environments Adding documentation to tox's configuration document describing how to take advantage of the `TOX_LIMITED_SHEBANG` environment variable to bypass system-defined shebang interpreter directive limits. Signed-off-by: James Knight <james.d.knight@live.com>
- Loading branch information
1 parent
ba51cfc
commit 65c5ed3
Showing
4 changed files
with
158 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Add support to explicitly invoke interpreter directives for environments with | ||
long path lengths. In the event that ``tox`` cannot invoke scripts with a | ||
system-limited shebang (e.x. a Linux host running a Jenkins Pipeline), a user | ||
can set the environment variable ``TOX_LIMITED_SHEBANG`` to workaround the | ||
system's limitation (e.x. ``export TOX_LIMITED_SHEBANG=1``) - by @jdknight |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters