-
Notifications
You must be signed in to change notification settings - Fork 561
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
t/harness can mistakenly run tests outside of the perl source tree #14578
Comments
From @steve-m-hayIf I have a cpan/Text-Balanced folder (containing a Git workspace of the CPAN Text-Balanced distro) alongside my perl source tree then t/harness will mistakenly run the tests in ../../cpan/Text-Balanced/t/ (outside the perl source tree) instead of the intended ../cpan/Text-Balanced/t/ (inside the perl source tree). It happens because of this little snippet in t/harness: # Allow eg ./perl t/harness t/op/lc.t but I'm not sure off-hand how best to fix it to be absolutely sure that it doesn't end up outside of the perl source tree. |
From @jkeenanOn Thu Mar 12 02:24:36 2015, shay wrote:
Unless someone has a brainstorm about this, I would suggest simply documenting it in pod/perlhack.pod as a known limitation of t/harness. -- |
The RT System itself - Status changed from 'new' to 'open' |
From @bulk88On Sat Mar 14 16:14:00 2015, jkeenan wrote:
I've either reported (and someone else fixed) or fixed a dozen of these bugs in the last 3 years. This is a common class of bugs with the perl distro. -- |
From @wolfsageOn Thu, Mar 12, 2015 at 5:24 AM, Steve Hay <perlbug-followup@perl.org> wrote:
Possible patch attached. This may be 'better than nothing' (provided I -- Matthew Horsfall (alh) |
From @wolfsage0001-RT-124050-Try-really-hard-not-to-run-tests-outside-o.patchFrom 8999852eaf7db1cb193127c786127a0bb2a32a1e Mon Sep 17 00:00:00 2001
From: Matthew Horsfall <wolfsage@gmail.com>
Date: Sun, 24 Apr 2016 13:43:00 -0400
Subject: [PATCH] RT: #124050 - Try really hard not to run tests outside of
source tree.
Assume if the user passed in a path with '../' that they were in t/
aiming for a test a level up somewhere.
---
t/harness | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/harness b/t/harness
index d069472..f0cbcd6 100644
--- a/t/harness
+++ b/t/harness
@@ -188,7 +188,7 @@ if ($^O eq 'MSWin32') {
# Allow eg ./perl t/harness t/op/lc.t
for (@tests) {
- if (-f "../$_") {
+ if ($_ !~ /^\.\./ && -f "../$_") {
$_ = "../$_";
s{^\.\./t/}{};
}
--
1.9.1
|
From @iabynOn Sun, Apr 24, 2016 at 01:46:59PM -0400, Matthew Horsfall (alh) wrote:
I've applied a slightly enhanced version of that: commit 683433b t/harness: avoid tests outside the src tree Affected files ... Differences ... Inline Patchdiff --git a/t/harness b/t/harness
index d069472..b46582d 100644
--- a/t/harness
+++ b/t/harness
@@ -188,7 +188,7 @@ if ($^O eq 'MSWin32') {
# Allow eg ./perl t/harness t/op/lc.t
for (@tests) {
- if (-f "../$_") {
+ if (! -f $_ && !/^\.\./ && -f "../$_") {
$_ = "../$_";
s{^\.\./t/}{};
}
-- Indomitable in retreat, invincible in advance, insufferable in victory |
From @wolfsageOn Mon, Jun 20, 2016 at 7:00 AM, Dave Mitchell <davem@iabyn.com> wrote:
Ah yes, much better. Thanks. -- Matthew Horsfall (alh) |
@iabyn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#124050 (status was 'resolved')
Searchable as RT124050$
The text was updated successfully, but these errors were encountered: