Skip to content

Commit d3402a1

Browse files
committed
Bugfix: match full pathname element (partial match can break depending on 'readdir' order).
Signed-off-by: Henry Cox <henry.cox@mediatek.com>
1 parent 44ce81d commit d3402a1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/gendiffcov/insensitive/annotate.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ OUTER: while ($dir &&
3333

3434
if (opendir(my $d, $dir)) {
3535
foreach my $name (readdir($d)) {
36-
if ($name =~ /$f/i) {
36+
if ($name =~ /^$f$/i) {
3737
push(@stack, $name);
3838
last OUTER;
3939
}
@@ -46,7 +46,7 @@ while (1 < scalar(@stack)) {
4646
my $f = pop(@stack);
4747
opendir(my $d, $path) or die("cannot read dir $path");
4848
foreach my $name (readdir($d)) {
49-
if ($name =~ /$f/i) {
49+
if ($name =~ /^$f$/i) {
5050
$path = File::Spec->catdir($path, $name);
5151
last;
5252
}
@@ -61,9 +61,9 @@ $f = pop(@stack)
6161
my $annotated = File::Spec->catfile($path, $f . ".annotated");
6262
opendir my $d, $path or die("cannot read $path");
6363
foreach my $name (readdir($d)) {
64-
if ($name =~ /$f\.annotated/i) {
64+
if ($name =~ /^$f\.annotated$/i) {
6565
$annotated = File::Spec->catfile($path, $name);
66-
} elsif ($name =~ /$f/i) { # case insensitive match
66+
} elsif ($name =~ /^$f$/i) { # case insensitive match
6767
$file = File::Spec->catfile($path, $name);
6868
}
6969
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy