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
Silently ignores commonly-misspelled PERL5OPTS environment variable #16757
Comments
From @leonerdCreated by leo@shy.leoI often forget the name of the variable and get confused when (e.g.) $ PERL5OPTS=-MDevel::Cover prove -r doesn't work. The variable name I wanted was PERL5OPT. I wonder if core could add a little if(getenv("PERL5OPTS")) Perl Info
|
From @jkeenanOn Mon, 19 Nov 2018 17:07:44 GMT, leonerd@leonerd.org.uk wrote:
If you could propose a patch (including a test), that would probably move discussion forward. Thank you very much. |
The RT System itself - Status changed from 'new' to 'open' |
From @TuxOn Thu, 06 Dec 2018 12:28:04 -0800, "James E Keenan via RT" <perlbug-followup@perl.org> wrote:
Maybe perl6 people could help/chime in $ perl6 -e'my $perl5opt = "monkey"; say $perl5opts' So they already have the feature to do it for variables, why not And that could trigger someone else to do it for variables in perl5 -- |
From @leonerdOn Thu, 06 Dec 2018 12:28:04 -0800
Attached is a patch for the code. Unsure quite how to make an automated test for it, but in practice: $ PERL5OPT=-Mblib ./miniperl -e1 $ PERL5OPTS=-Mblib ./miniperl -e1 -- leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS |
From @leonerd0001-Warn-if-PERL5OPTS-is-set.patchFrom 162bbc29e52785f4d3f3d5f71fd92955472658d5 Mon Sep 17 00:00:00 2001
From: "Paul \"LeoNerd\" Evans" <leonerd@leonerd.org.uk>
Date: Sat, 8 Dec 2018 19:54:25 +0000
Subject: [PATCH] Warn if PERL5OPTS is set
---
perl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/perl.c b/perl.c
index 739ec7ef02..306e260399 100644
--- a/perl.c
+++ b/perl.c
@@ -2272,6 +2272,9 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
}
}
}
+ else if(PerlEnv_getenv("PERL5OPTS"))
+ Perl_warner(aTHX_ packWARN(WARN_MISC),
+ "The PERL5OPTS environment variable is set - did you mean PERL5OPT instead?\n");
}
#ifndef NO_PERL_INTERNAL_RAND_SEED
--
2.19.2
|
From dcmertens.perl@gmail.comMerijn, They must be using some kind of fuzzy string matching ( On the one hand, I think this is a bad idea. Compared to a basic The next natural step would be suggesting variable or function names when David On Fri, Dec 7, 2018 at 2:17 AM H.Merijn Brand <h.m.brand@xs4all.nl> wrote:
-- |
From @TuxOn Sun, 9 Dec 2018 05:45:01 -0500, David Mertens
IMHO fuzzy lookup should *only* be implemented at compile-time logic, Furthermore, %ENV is a tricky one, as you cannot check compile-time
Again, only for compile-time fails, otherwise all mixin-like modules I for one do *not* like the exception code for one single misspelling
-- |
From @xsawyerx[Top posting] We can either detect similarity or specific wrongly-spelled. We should * If it's fuzzy, we assume the fuzziness does not mean anything. * If there was some "ownership" of a list of options, we could maintain * We can support specific options (per Paul's patch) but then we're just In the long term, perhaps a Perl5-owned list of environment variables The last option of specifics is also available, but it requires picking The first option of fuzzy matching is, by far, my least favorite. It's On 12/9/18 1:03 PM, H.Merijn Brand wrote:
|
Instead of a general solution, why can't we just accept either spelling of this variable? |
One reason I can come up with: both are defined. In that case: which will take precedence? |
On 4/24/23 00:50, H.Merijn Brand wrote:
One reason I can come up with: both are defined. In that case: which
will take precedence?
What if both are defined and they conflict?
I hadn't thought about that. But I think we would handle it the same
way we already do when PERl5OPT contains something that conflicts with
explicitly specified command line options; its just we would have 3
sources instead of two. We might want to warn.
…
—
Reply to this email directly, view it on GitHub
<#16757 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA2DH4HRXFITSFQJ43X3WDXCYPEJANCNFSM6AAAAAAXI3JLCE>.
You are receiving this because you commented.Message ID:
***@***.***>
|
There are many pieces of code that try to isolate themselves from outside variables, for testing and similar cases. This would add an additional variable that would need to be localized. Most likely, the code trying to do that would not be updated, and would instead start to fail when |
We've discussed this during the PTS in Lyon and came to the conclusion that supporting both is not an option (pun intended). |
Migrated from rt.perl.org#133669 (status was 'open')
Searchable as RT133669$
The text was updated successfully, but these errors were encountered: