Skip to content

Commit 7753463

Browse files
committed
sort values returned by readdir to improve reproducibility
1 parent 8ef9203 commit 7753463

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/LaTeXML/Util/Pathname.pm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ sub candidate_pathnames {
400400
opendir(my $dir_handle, $dir) or next;
401401
my @dir_files = readdir($dir_handle);
402402
closedir($dir_handle);
403+
my @dir_paths;
403404
for my $local_file (@dir_files) {
404405
for my $regex_pair (@regexes) {
405406
my ($i_regex, $regex) = @$regex_pair;
@@ -409,7 +410,8 @@ sub candidate_pathnames {
409410
if ($local_file =~ m/$regex/) {
410411
# if we are only interested in the first match, return it:
411412
return ($full_file) if $options{findfirst};
412-
push(@paths, $full_file); } } } } }
413+
push(@dir_paths, $full_file); } } } }
414+
push(@paths, sort @dir_paths); }
413415
# Fallback: if no strict matches were found, return any existing case-insensitive matches
414416
# Defer the -f check until we are sure we need it, to keep the usual cases fast.
415417
return @paths ? @paths : @nocase_paths; }

0 commit comments

Comments
 (0)