Splitting on :/: is a bad idea for paths like "//server/dir".  Since
parallel already uses File::Path, use File::Path::mkpath instead which is
known to work correctly.  Note that I'm using the legacy interface here for
backwards compatibility with the rest of parallel, changing to the current
make_path API would additionally require the import of that symbol.

--- /old/parallel  2016-03-10 13:22:02.000000000 +0100
+++ /bin/parallel       2016-04-13 14:00:44.082526100 +0200
@@ -3681,16 +3681,9 @@
 sub mkdir_or_die {
     # If dir is not executable: die
     my $dir = shift;
-    my @dir_parts = split(m:/:,$dir);
-    my ($ddir,$part);
-    while(defined ($part = shift @dir_parts)) {
-       $part eq "" and next;
-       $ddir .= "/".$part;
-       -d $ddir and next;
-       mkdir $ddir;
-    }
+    File::Path::mkpath($dir);
     if(not -x $dir) {
-       ::error("Cannot write to $dir: $!");
+       ::error("Cannot change into non-executable $dir: $!");
        ::wait_and_exit(255);
     }
 }


Regards,
Achim.


Reply via email to