You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "Shixiong Zhu (Jira)" <ji...@apache.org> on 2019/10/16 00:25:00 UTC
[jira] [Commented] (HDFS-14762) "Path(Path/String parent, String
child)" will fail when "child" contains ":"
[ https://issues.apache.org/jira/browse/HDFS-14762?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16952404#comment-16952404 ]
Shixiong Zhu commented on HDFS-14762:
-------------------------------------
[~ayushtkn] Some file systems allow ":" in the name. For example, in the local file system, the following Scala codes will fail because it cannot create a path for the checksum file ".a:b.crc" on Linux. But "/tmp/a:b" will be created.
{code:java}
import org.apache.hadoop.fs._
import org.apache.hadoop.conf._
val conf = new Configuration
val path = new Path("file:///tmp/a:b")
val fs = path.getFileSystem(conf)
fs.create(path).close()
{code}
The same issue happens in S3AFileSystem.
IMO, since both FileSystem and Path are generic classes, if ":" should not appear in a valid file name, it should be checked in abstract FileSystem class rather than HDFS. If FileSystem doesn't check it and it's not enforced in all FileSystems, it should be a valid char in a file name, and should be fixed in Path.
> "Path(Path/String parent, String child)" will fail when "child" contains ":"
> ----------------------------------------------------------------------------
>
> Key: HDFS-14762
> URL: https://issues.apache.org/jira/browse/HDFS-14762
> Project: Hadoop HDFS
> Issue Type: Bug
> Reporter: Shixiong Zhu
> Priority: Major
> Attachments: HDFS-14762.001.patch, HDFS-14762.002.patch, HDFS-14762.003.patch, HDFS-14762.004.patch
>
>
> When the "child" parameter contains ":", "Path(Path/String parent, String child)" will throw the following exception:
> {code}
> java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ...
> {code}
> Not sure if this is a legit bug. But the following places will hit this error when seeing a Path with a file name containing ":":
> https://github.com/apache/hadoop/blob/f9029c4070e8eb046b403f5cb6d0a132c5d58448/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ChecksumFileSystem.java#L101
> https://github.com/apache/hadoop/blob/f9029c4070e8eb046b403f5cb6d0a132c5d58448/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Globber.java#L270
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org