[ https://issues.apache.org/jira/browse/HADOOP-10820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14068776#comment-14068776 ]
Koji Noguchi commented on HADOOP-10820: --------------------------------------- This reminds me of a very old bug HADOOP-1386 from 7 years ago. Maybe it's better to fix this issue at the lower layer and disallow creation of Path from an empty URI. Simple test code as below. If you uncomment the 'delete', it'll wipe the entire current directory instead of throwing the IllegalArgumentException. {code:java} import org.apache.hadoop.fs.Path; import java.lang.IllegalArgumentException; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.RawLocalFileSystem; import java.net.URI; public class TestEmptyPath { public static void main(String[] args) throws Exception { FileSystem fs = new RawLocalFileSystem(); try { Path path = new Path(""); System.out.println("Path from empty String is " + path); System.exit(123); } catch (IllegalArgumentException ex) { System.out.println("Empty Path creation error successfully captured [" + ex + "]"); } try { URI emptyuri = new URI(""); Path path = new Path(emptyuri); System.out.println("Path from empty URI is " + path); // IF YOU UNCOMMENT THIS LINE, IT WILL WIPE YOUR ENTIRE CURRENT DIR!!! //fs.delete(path, true); System.exit(234); } catch (IllegalArgumentException ex) { System.out.println("Empty Path creation error successfully captured [" + ex + "]"); System.exit(0); } } } {code} {noformat} -bash-4.1$ ls -l total 8 drwxr-xr-x 2 ___ users 4096 Jul 21 16:54 bcd -rw-r--r-- 1 ___ users 5 Jul 21 16:54 efg -bash-4.1$java -cp..... TestEmptyPath Empty Path creation error successfully captured [java.lang.IllegalArgumentException: Can not create a Path from an empty string] Path from empty URI is -bash-4.1$ echo $? 234 -bash-4.1$ ls -l total 0 -bash-4.1$ {noformat} > Empty entry in libjars results in working directory being recursively > localized > ------------------------------------------------------------------------------- > > Key: HADOOP-10820 > URL: https://issues.apache.org/jira/browse/HADOOP-10820 > Project: Hadoop Common > Issue Type: Bug > Affects Versions: 2.2.0 > Reporter: Alex Holmes > Priority: Minor > Attachments: HADOOP-10820-1.patch, HADOOP-10820.patch > > > An empty token (e.g. "a.jar,,b.jar") in the -libjars option causes the > current working directory to be recursively localized. > Here's an example of this in action (using Hadoop 2.2.0): > {code} > # create a temp directory and touch three JAR files > mkdir -p tmp/path && cd tmp && touch a.jar b.jar c.jar path/d.jar > # Run an example job only specifying two of the JARs. > # Include an empty entry in libjars. > hadoop jar > /usr/local/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.2.0.jar > pi -libjars a.jar,,c.jar 2 1000000000 > # As the job is running examine the localized directory in HDFS. > # Notice that not only are the two JAR's specified in libjars copied, > # but in addition the contents of the working directory are also recursively > copied. > $ hadoop fs -lsr > /tmp/hadoop-yarn/staging/aholmes/.staging/job_1404752711144_0018/libjars > /tmp/hadoop-yarn/staging/aholmes/.staging/job_1404752711144_0018/libjars/a.jar > /tmp/hadoop-yarn/staging/aholmes/.staging/job_1404752711144_0018/libjars/c.jar > /tmp/hadoop-yarn/staging/aholmes/.staging/job_1404752711144_0018/libjars/tmp > /tmp/hadoop-yarn/staging/aholmes/.staging/job_1404752711144_0018/libjars/tmp/a.jar > /tmp/hadoop-yarn/staging/aholmes/.staging/job_1404752711144_0018/libjars/tmp/b.jar > /tmp/hadoop-yarn/staging/aholmes/.staging/job_1404752711144_0018/libjars/tmp/c.jar > /tmp/hadoop-yarn/staging/aholmes/.staging/job_1404752711144_0018/libjars/tmp/path > /tmp/hadoop-yarn/staging/aholmes/.staging/job_1404752711144_0018/libjars/tmp/path/d.jar > {code} -- This message was sent by Atlassian JIRA (v6.2#6252)