cr0sh opened PR #5035 from run-piped-modules
to main
:
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[v] This has been discussed in issue #..., or if not, please tell us why
here.[v] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[v] This PR contains test cases, if meaningful.
- [v] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->This is not discussed in the issue tracker, but on this Zulip thread.
Previously load_module opened a file on
path
to check if the module is precompiled, then closes before constructing the Module from it. This is fine on normal files, but on piped files(like /dev/stdin), is problematic as the header read is not visible on the next open.So, this set of commits change the procedure to 1) try to mmap the whole file from the
path
. 2) If it fails(implying the file is something special), read the whole file into the buffer so we can safely read the header and reuse the buffer again on the subsequent Module::new.The Zulip thread contains an additional concern by me, about implicitly allowing accsesing
/dev/tty
on-
inputs, which is not considered here.
Last updated: Nov 22 2024 at 17:03 UTC