Preload is useless with tainting
Nobody has claimed this yet.
- #264 by @JRaspass — closed without merging
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- perl
- Domain
- testing-qa
Research direction
Start by reproducing the issue with the shown MyPreload, MyExpensive, and t/foo.t examples using yath test -TP, then inspect Test2::Harness::Runner::Preload and the taint-handling path. Done means taint-enabled tests can use preloaded libraries without paying their load time in startup or failing because the worker lacks taint mode.
Written by the indexing model from the issue text.
Description
Given the following stripped down example:
lib/MyExpensive.pm:
package MyExpensive;
sleep 1;
1;
lib/MyPreload.pm:
package MyPreload;
use Test2::Harness::Runner::Preload;
stage DEFAULT => sub { default; preload 'MyExpensive' };
1;
t/foo.t:
use Test2::V0 -target => 'MyExpensive';
ok $ENV{T2_HARNESS_PRELOAD};
done_testing;
Running the tests with preload shows everything passes and the extra second isn't attributed to the test's "startup" cost:
$ yath test -TP MyPreload
( PASSED ) job 1 t/foo.t
( TIME ) job 1 Startup: 0.04258s | Events: 0.00018s | Cleanup: 0.00407s | Total: 0.04683s
However if we add a tainting shebang to the test file:
#!perl -T
use Test2::V0 -target => 'MyExpensive';
ok $ENV{T2_HARNESS_PRELOAD};
done_testing;
Then the test fails and takes longer:
$ yath test -TP MyPreload
[ FAIL ] job 1 + <UNNAMED ASSERTION>
( DIAG ) job 1 Failed test at t/foo.t line 5.
( DIAG ) job 1 Seeded srand with seed '20230215' from local date.
( FAILED ) job 1 t/foo.t
( TIME ) job 1 Startup: 1.08933s | Events: 0.00030s | Cleanup: 0.00322s | Total: 1.09285s
Now imagine that you have hundreds of tests, all with tainting enabled and lots of expensive libraries that take seconds to load, suddenly you're in my situation where $WORK's codebase takes tens of minutes to test :-(
I thought this was a regression since I'm sure this used to work but I've yet to find a version where it works correctly.
I appreciate this is hard to make work as you can only adjust the taint mode at perl startup time and the worker you're forking doesn't have it enabled so can we either have multiple workers based on the set of interpreter flags we see in test files? Or an ugly hack to run all of yath under taint worker and all.
- Dominant language
- Perl
- Stars
- 28
- Forks
- 30
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Test-More/Test2-Harness
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
Test-More/Test2-Harness#457 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
Test-More/Test2-Harness#450 ·
-
Yath tests don't forward @INC to system commandsMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 3/5 1-2 days Newbie friendliness 48/100
Test-More/Test2-Harness#296 ·
-
The `t/integration/preload.t` test is broken on riscv64-linux (1.000155)May be free again A pull request for this issue was closed without being merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 42/100
Test-More/Test2-Harness#290 · 3 comments · 2 reactions ·
-
yath displays arbitrary filenames without escapingMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Test-More/Test2-Harness#286 · 1 comment ·
All issues in Test-More/Test2-Harness
Similar issues
-
observablt-ci
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
elastic/golang-crossbuild#840 ·
Maintainers usually reply within 1 day
-
Sync playback crashes repeatedly in a sync group (v9.1.1)Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
LMS-Community/slimserver#1701 · 6 comments ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
RotherOSS/otobo#6286 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
fix(api): API v3 Product Read ignores request language (lc) for sample products and image URLsPossibly taken @muntasir-396 claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
openfoodfacts/openfoodfacts-server#15042 · 1 comment ·
Maintainers usually reply within 1 day