From e8380dd84d558a05403a83d7166709c0ba87c9d3 Mon Sep 17 00:00:00 2001 From: Bruce Miller Date: Thu, 25 Apr 2024 18:59:21 -0400 Subject: [PATCH] fix kpse_cache corner cases --- lib/LaTeXML/Util/Pathname.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/LaTeXML/Util/Pathname.pm b/lib/LaTeXML/Util/Pathname.pm index 9b34f7107..f4b4a3a08 100644 --- a/lib/LaTeXML/Util/Pathname.pm +++ b/lib/LaTeXML/Util/Pathname.pm @@ -433,7 +433,7 @@ sub build_kpse_cache { foreach my $path (split(/$KPATHSEP/, $texpaths)) { $path =~ s/^!!//; $path =~ s|//+$|/|; push(@filters, $path) if -d $path; } - my $filterre = '(?:' . join('|', map { "\Q$_\E"; } @filters) . ')'; + my $filterre = scalar(@filters) && '(?:' . join('|', map { "\Q$_\E"; } @filters) . ')'; $texmf =~ s/^["']//; $texmf =~ s/["']$//; $texmf =~ s/^\s*\\\{(.+?)}\s*$/$1/s; $texmf =~ s/\{\}//g; @@ -453,7 +453,7 @@ sub build_kpse_cache { $subdir = $1; $subdir =~ s|^\./||; # remove prefix my $d = $dir . '/' . $subdir; # Hopefully OS safe, for comparison? - $skip = $d !~ /$filterre/; + $skip = $d !~ /$filterre/ if $filterre; $skip |= ($d =~ m|-dev[$//]|) unless $LaTeXML::DEBUG{'latex-dev'}; } elsif (!$skip) {