parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug/Patch] mkdir_or_die doesn't work correctly with network paths


From: Achim Gratz
Subject: [Bug/Patch] mkdir_or_die doesn't work correctly with network paths
Date: Wed, 13 Apr 2016 12:20:24 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

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

[Prev in Thread] Current Thread [Next in Thread]