From 245783338cb0bd50cafc152cfc2be5c69fa0b725 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 11 Jul 2025 15:07:16 +0200 Subject: [PATCH] runner.pm: use `dirname()` in `singletest_prepare()` Replacing a regex, for portability. Reported-by: Stefan Eissing Bug: https://github.com/curl/curl/issues/17871#issuecomment-3051830614 Cherry-picked from #17877 Closes #17900 --- tests/runner.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/runner.pm b/tests/runner.pm index 9ebee05988..d4a4dc3852 100644 --- a/tests/runner.pm +++ b/tests/runner.pm @@ -38,6 +38,8 @@ use strict; use warnings; use 5.006; +use File::Basename; + BEGIN { use base qw(Exporter); @@ -765,9 +767,7 @@ sub singletest_prepare { my $fileContent = join('', @inputfile); # make directories if needed - my $path = $filename; - # cut off the file name part - $path =~ s/^(.*)\/[^\/]*/$1/; + my $path = dirname($filename); my @ldparts = split(/\//, $LOGDIR); my $nparts = @ldparts; my @parts = split(/\//, $path); -- 2.47.2