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

Avoid calling setenv with identical previous contents. #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Blub
Copy link

@Blub Blub commented Oct 9, 2023

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

Note: ideally we could avoid the 2nd query to the env vars, but that would require a breaking change to ProbeResult to include where the values came from.

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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant