Avoid calling setenv with identical previous contents.#27
Merged
alexcrichton merged 1 commit intorustls:masterfrom Jan 23, 2025
Merged
Avoid calling setenv with identical previous contents.#27alexcrichton merged 1 commit intorustls:masterfrom
alexcrichton merged 1 commit intorustls:masterfrom
Conversation
As also stated in the stdlib documentation, setenv() is a bit of a dangerous interface and can cause a lot of headaches. For instance, perl before version 5.38 (at the time of writing, debian stable (bookworm) uses version 5.36) manipulates the `environ` pointer directly. When calling rust (or any other language) code from perl via bindings, calling `setenv` easily leads to crashes[2]. In perl 5.38 this was fixed [1] and perl should itself also stick to using `setenv`. This improves the situation a lot and leaves only the threading issue we cannot solve here. This commit allows the perl code to preset the environment variables to avoid at least this instance of setenv causing crashes. See-also: Perl/perl5#339 See-also: Perl/perl5#859 See-also: [1] Perl/perl5@916a038 See-also: [2] https://bugzilla.proxmox.com/show_bug.cgi?id=4979 Signed-off-by: Wolfgang Bumiller <[email protected]>
Collaborator
|
I'm about a year and a half late to the punch but... hopefully better late the never? (sorry) |
Collaborator
|
and thanks of course! (although I realize that's diluted taking >1 year to respond...) |
Contributor
Author
|
We've just been patching it on our end and it's really just a workaround anyway. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As also stated in the stdlib documentation, setenv() is a bit of a dangerous interface and can cause a lot of headaches. For instance, perl before version 5.38 (at the time of writing, debian stable (bookworm) uses version 5.36) manipulates the
environpointer directly. When calling rust (or any other language) code from perl via bindings, callingsetenveasily leads to crashes[2].In perl 5.38 this was fixed [1] and perl should itself also stick to using
setenv. This improves the situation a lot and leaves only the threading issue we cannot solve here.This commit allows the perl code to preset the environment variables to avoid at least this instance of setenv causing crashes.
See-also: Perl/perl5#339
See-also: Perl/perl5#859
See-also: [1] Perl/perl5@916a038
See-also: [2] https://bugzilla.proxmox.com/show_bug.cgi?id=4979
Note: ideally we could avoid the 2nd query to the env vars, but that would require a breaking change to
ProbeResultto include where the values came from.