File latexmk_perl.dif of Package texlive-specs-n.10058
---
texmf-dist/scripts/latexmk/latexmk.pl | 34 ++++++++++++++++++++++++++++++----
1 file changed, 30 insertions(+), 4 deletions(-)
--- texmf-dist/scripts/latexmk/latexmk.pl
+++ texmf-dist/scripts/latexmk/latexmk.pl 2018-05-28 14:01:23.778292466 +0000
@@ -127,7 +127,33 @@ $version_details = "$My_name, John Colli
use Config;
use File::Basename;
use File::Copy;
-use File::Glob ':glob'; # Better glob. Does not use space as item separator.
+
+# If possible, use better glob, which does not use space as item separator.
+# It's either File::Glob::bsd_glob or File::Glob::glob
+# The first does not exist in old versions of Perl, while the second
+# is deprecated in more recent versions and will be removed
+$have_bsd_glob = 0;
+sub my_glob {
+ if ($have_bsd_glob) { return bsd_glob( $_[0] ); }
+ else { return glob( $_[0] ); }
+}
+use File::Glob;
+if ( eval{ File::Glob->import('bsd_glob'); 1; } ) {
+ # Success in importing bsd_glob
+ $have_bsd_glob = 1;
+}
+elsif ( eval{ File::Glob->import('glob'); 1; } ) {
+ warn "$My_name: I could not import File::Glob:bsd_glob, probably because your\n",
+ " Perl is too old. I have arranged to use the deprecated File::Glob:glob\n",
+ " instead.\n",
+ " WARNING: It may malfunction on clean up operation on filenames containing\n",
+ " spaces.\n";
+ $have_bsd_glob = 0;
+}
+else {
+ die "Could not import 'File::Glob:bsd_glob' or 'File::Glob:glob'\n";
+}
+
use File::Path 2.08 qw( make_path );
use FileHandle;
use File::Find;
@@ -3249,8 +3275,8 @@ sub cleanup1 {
my $dir = fix_pattern( shift );
my $root_fixed = fix_pattern( $root_filename );
foreach (@_) {
- (my $name = /%R/ ? $_ : "%R.$_") =~ s/%R/$dir$root_fixed/;
- unlink_or_move( glob( "$name" ) );
+ (my $name = /%R/ ? $_ : "%R.$_") =~ s/%R/${dir}${root_fixed}/;
+ unlink_or_move( my_glob( "$name" ) );
}
} #END cleanup1
@@ -7803,7 +7829,7 @@ sub glob_list1 {
}
else {
# This glob fails to work as desired, if the pattern contains spaces.
- push @globbed, glob( "$file_spec" );
+ push @globbed, my_glob( "$file_spec" );
}
}
return @globbed;