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
$ENV{foo}=undef #12337
Comments
From @cpansproutperldelta for 5.17.3 has this under Incompatible Changes: =head2 C<$ENV{foo}=undef> deletes value from environ, like C<delete $ENV{foo}> This facilitates use of C<local()> with C<%ENV> entries. In previous versions I don’t recall seeing this discussed. This change makes Perl less consistent with itself. For undef to be converted to the empty string is normal. For $hash{key} = undef to delete the hash element is abnormal. And I don’t see what it provides, except inconsistency. We already have delete local. I think this should be reverted. Flags: Site configuration information for perl 5.17.3: Configured by sprout at Mon Jul 30 23:46:13 PDT 2012. Summary of my perl5 (revision 5 version 17 subversion 3) configuration: Locally applied patches: @INC for perl 5.17.3: Environment for perl 5.17.3: |
From @doyOn Sun, Aug 19, 2012 at 12:20:21PM -0700, Father Chrysostomos wrote:
+1 -doy |
The RT System itself - Status changed from 'new' to 'open' |
From Eirik-Berg.Hanssen@allverden.noOn Mon, Aug 20, 2012 at 11:19 AM, Jesse Luehrs <doy@tozt.net> wrote:
Briefly discussed, July 25th. Questioned: Answered: But yeah, the answer seems a bit too brief. As you note, C<< delete As it is part of a bigger change, I wouldn't ask for it all to be Eirik |
From @cpansproutOn Mon Aug 20 03:16:41 2012, Eirik-Berg.Hanssen@allverden.no wrote:
I do recall that now, but I did not understand it at the time. I
Anything’s doable. :-) It’s probably simple, too. -- Father Chrysostomos |
From [Unknown Contact. See original ticket]On Mon Aug 20 03:16:41 2012, Eirik-Berg.Hanssen@allverden.no wrote:
I do recall that now, but I did not understand it at the time. I
Anything’s doable. :-) It’s probably simple, too. -- Father Chrysostomos |
From @rjbs* Father Chrysostomos via RT <perlbug-comment@perl.org> [2012-08-20T11:26:08]
I also thought so. I wonder whether Chip was not aware that "delete local" had been made to work; Chip, can you weigh in on this? -- |
From @cpansproutOn Fri Aug 24 18:20:10 2012, perl.p5p@rjbs.manxome.org wrote:
It turns out that perldelta entry that inspired this ticket is wrong. $ ./perl -Ilib -le '$ENV{PATH} = undef; print exists $ENV{PATH}; local Nothing more to do here, as far as I’m concerned. -- Father Chrysostomos |
From [Unknown Contact. See original ticket]On Fri Aug 24 18:20:10 2012, perl.p5p@rjbs.manxome.org wrote:
It turns out that perldelta entry that inspired this ticket is wrong. $ ./perl -Ilib -le '$ENV{PATH} = undef; print exists $ENV{PATH}; local Nothing more to do here, as far as I’m concerned. -- Father Chrysostomos |
@cpansprout - Status changed from 'open' to 'resolved' |
From @xsawyerxOn 10/13/2012 04:03 PM, Father Chrysostomos via RT wrote:
|
From @cpansproutOn Mon Oct 15 15:04:28 2012, xsawyerx@gmail.com wrote:
No. The VMS issue only have to do with clobbering %ENV as a whole, as -- Father Chrysostomos |
From [Unknown Contact. See original ticket]On Mon Oct 15 15:04:28 2012, xsawyerx@gmail.com wrote:
No. The VMS issue only have to do with clobbering %ENV as a whole, as -- Father Chrysostomos |
From @chipdudeOn Fri, Aug 24, 2012 at 09:19:40PM -0400, Ricardo Signes wrote:
Indeed I wasn't aware. The below code works (no die) on 5.14: # Test that $ENV{X} = undef does *not* need a special case So special case of C<$ENV{X}=undef> performing unsetenv is a mistake and |
@cpansprout - Status changed from 'resolved' to 'open' |
From @rjbsOn Tue Oct 16 09:44:42 2012, rev.chip@gmail.com wrote:
This has yet to be resolved. -- |
From @kentfredricOn Fri Feb 08 07:59:37 2013, rjbs wrote:
I gave a shot at patching this and it seemed like the code required was Included is tests for the undef =~ "" behaviour, and tests pass. I read C<man setenv> and it doesn't seem to specify anywhere that |
From @kentfredric0001-mg.c-revert-ENV-x-undef-behaviour-to-be-empty-string.patchFrom 0c265b21c8a971f03c7c90a8c325621f586a96d0 Mon Sep 17 00:00:00 2001
From: Kent Fredric <kentfredric@gmail.com>
Date: Sun, 17 Feb 2013 06:07:59 +1300
Subject: [PATCH] mg.c : revert ENV{x} = undef behaviour to be empty string,
not key deletion
pod/perldelta.pod: document reversion of ENV{foo} = undef behaviour in delta
t/op/magic.t: add a test for ENV{foo} = undef
---
mg.c | 2 +-
pod/perldelta.pod | 7 +++++++
t/op/magic.t | 6 +++++-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/mg.c b/mg.c
index e4711e7..6811727 100644
--- a/mg.c
+++ b/mg.c
@@ -1101,7 +1101,7 @@ Perl_magic_setenv(pTHX_ SV *sv, MAGIC *mg)
dVAR;
STRLEN len = 0, klen;
const char * const key = MgPV_const(mg,klen);
- const char *s = NULL;
+ const char *s = "";
PERL_ARGS_ASSERT_MAGIC_SETENV;
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 3fc33ac..c7d6e34 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -53,6 +53,13 @@ XXX For a release on a stable branch, this section aspires to be:
If any exist, they are bugs, and we request that you submit a
report. See L</Reporting Bugs> below.
+=head2 C<$ENV{foo} = undef> no longer deletes value from environ
+
+5.17.3 Introduced a change where assiging C<undef> to an C<%ENV> key was equivalent
+to C<delete $ENV{foo}>.
+
+This release reverts that change.
+
[ List each incompatible change as a =head2 entry ]
=head1 Deprecations
diff --git a/t/op/magic.t b/t/op/magic.t
index 990de55..5421d01 100644
--- a/t/op/magic.t
+++ b/t/op/magic.t
@@ -5,7 +5,7 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
require './test.pl';
- plan (tests => 178);
+ plan (tests => 179);
}
# Test that defined() returns true for magic variables created on the fly,
@@ -647,9 +647,13 @@ SKIP: {
}
$ENV{__NoNeSuCh} = 'foo';
+ $ENV{__NoNeSuCh2} = 'foo';
$0 = 'bar';
env_is(__NoNeSuCh => 'foo', 'setting $0 does not break %ENV');
+ $ENV{__NoNeSuCh2} = undef;
+ env_is(__NoNeSuCh2 => '', 'setting a key as undef does not delete it');
+
# stringify a glob
$ENV{foo} = *TODO;
env_is(foo => '*main::TODO', 'ENV store of stringified glob');
--
1.7.12.4
|
From @kentfredricJust regenerated the patch with a cleanup of the ENV variable I added for |
From @kentfredric0001-mg.c-revert-ENV-x-undef-behaviour-to-be-empty-string.patchFrom 0c265b21c8a971f03c7c90a8c325621f586a96d0 Mon Sep 17 00:00:00 2001
From: Kent Fredric <kentfredric@gmail.com>
Date: Sun, 17 Feb 2013 06:07:59 +1300
Subject: [PATCH] mg.c : revert ENV{x} = undef behaviour to be empty string,
not key deletion
pod/perldelta.pod: document reversion of ENV{foo} = undef behaviour in delta
t/op/magic.t: add a test for ENV{foo} = undef
---
mg.c | 2 +-
pod/perldelta.pod | 7 +++++++
t/op/magic.t | 6 +++++-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/mg.c b/mg.c
index e4711e7..6811727 100644
--- a/mg.c
+++ b/mg.c
@@ -1101,7 +1101,7 @@ Perl_magic_setenv(pTHX_ SV *sv, MAGIC *mg)
dVAR;
STRLEN len = 0, klen;
const char * const key = MgPV_const(mg,klen);
- const char *s = NULL;
+ const char *s = "";
PERL_ARGS_ASSERT_MAGIC_SETENV;
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 3fc33ac..c7d6e34 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -53,6 +53,13 @@ XXX For a release on a stable branch, this section aspires to be:
If any exist, they are bugs, and we request that you submit a
report. See L</Reporting Bugs> below.
+=head2 C<$ENV{foo} = undef> no longer deletes value from environ
+
+5.17.3 Introduced a change where assiging C<undef> to an C<%ENV> key was equivalent
+to C<delete $ENV{foo}>.
+
+This release reverts that change.
+
[ List each incompatible change as a =head2 entry ]
=head1 Deprecations
diff --git a/t/op/magic.t b/t/op/magic.t
index 990de55..5421d01 100644
--- a/t/op/magic.t
+++ b/t/op/magic.t
@@ -5,7 +5,7 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
require './test.pl';
- plan (tests => 178);
+ plan (tests => 179);
}
# Test that defined() returns true for magic variables created on the fly,
@@ -647,9 +647,13 @@ SKIP: {
}
$ENV{__NoNeSuCh} = 'foo';
+ $ENV{__NoNeSuCh2} = 'foo';
$0 = 'bar';
env_is(__NoNeSuCh => 'foo', 'setting $0 does not break %ENV');
+ $ENV{__NoNeSuCh2} = undef;
+ env_is(__NoNeSuCh2 => '', 'setting a key as undef does not delete it');
+
# stringify a glob
$ENV{foo} = *TODO;
env_is(foo => '*main::TODO', 'ENV store of stringified glob');
--
1.7.12.4
|
From [Unknown Contact. See original ticket]Just regenerated the patch with a cleanup of the ENV variable I added for |
From @cpansproutOn Sat Feb 16 10:46:39 2013, kentfredric wrote:
Thank you. Applied as 888a67f. -- Father Chrysostomos |
From [Unknown Contact. See original ticket]On Sat Feb 16 10:46:39 2013, kentfredric wrote:
Thank you. Applied as 888a67f. -- Father Chrysostomos |
@cpansprout - Status changed from 'open' to 'resolved' |
@rjbs - Status changed from 'resolved' to 'open' |
From @rjbsThis was applied, but only after not being smoke-me'd first. It breaks Win32, t/op/magic.t -- |
From @tonycozOn Wed Feb 20 18:56:12 2013, rjbs wrote:
Steve fixed it, see: http://www.nntp.perl.org/group/perl.daily-build.reports/2013/02/msg137334.html Re-closing. Tony |
@tonycoz - Status changed from 'open' to 'resolved' |
From @craigberryOn Sat, Feb 16, 2013 at 12:46 PM, Kent Fredric via RT
If you're referring to the snippets of eccentricity in mg.c and hv.c, I'm actually not sure what to do about this change on VMS. ok 157 - setting $0 does not break %ENV What's happening here is that when we set an environment variable to When we retrieve such a value from Perl, we correctly recognize that $ perl -e "$ENV{XYZ}='foo'; $ENV{XYZ}=undef; print qq/exists but but the env_is() subroutine in magic.t is retrieving that null byte by |
Migrated from rt.perl.org#114504 (status was 'resolved')
Searchable as RT114504$
The text was updated successfully, but these errors were encountered: