Enable -DPERL_USE_SAFE_PUTENV in older versions of Perl on darwin.#69
Merged
Conversation
-DPERL_USE_SAFE_PUTENV was removed in Perl 5.37.1, but it is still required for older versions of Perl on darwin. Made the following changes to hints/darwin.sh: ```diff --- hints/darwin.sh.old 2026-03-22 00:12:35 +++ hints/darwin.sh 2026-03-22 00:13:13 @@ -526,6 +526,26 @@ # makefile in the same place. Since Darwin uses GNU make, this dodges # the problem. firstmakefile=GNUmakefile; + +# >= 5.23.6 and <= 5.37.0 have a problem with setenv() in atfork handlers on Darwin, +# so enable -DPERL_USE_SAFE_PUTENV, ref. Perl/perl5@e396210 +# This behavior became the default after version 5.37.0, ref. Perl/perl5@ae6b6b7 +if [ "$perl_revision" -eq 5 ] && \ + { [ "$perl_version" -gt 23 ] || \ + { [ "$perl_version" -eq 23 ] && [ "$perl_subversion" -ge 6 ]; }; } && \ + { [ "$perl_version" -lt 37 ] || \ + { [ "$perl_version" -eq 37 ] && [ "$perl_subversion" -le 0 ]; }; } +then + # Parts of the system call setenv(), in particular in an atfork handler. + # This causes problems when the child tries to clean up environ[], so + # let libc manage environ[]. + cat >> config.over <<'EOOVER' +if test "$d_unsetenv" = "$define" -a \ + `expr "$ccflags" : '.*-DPERL_USE_SAFE_PUTENV'` -eq 0; then + ccflags="$ccflags -DPERL_USE_SAFE_PUTENV" +fi +EOOVER +fi # if you use a newer toolchain before OS X 10.9 these functions may be # incorrectly detected, so disable them ``` fixes bingos#68
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.
-DPERL_USE_SAFE_PUTENV was removed in Perl 5.37.1, but it is still required for older versions of Perl on darwin.
Made the following changes to hints/darwin.sh:
fixes #68