You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Arpit Agarwal (JIRA)" <ji...@apache.org> on 2013/08/02 00:17:48 UTC
[jira] [Created] (HADOOP-9819) FileSystem#rename is broken, deletes
target when renaming link to itself
Arpit Agarwal created HADOOP-9819:
-------------------------------------
Summary: FileSystem#rename is broken, deletes target when renaming link to itself
Key: HADOOP-9819
URL: https://issues.apache.org/jira/browse/HADOOP-9819
Project: Hadoop Common
Issue Type: Bug
Components: fs
Affects Versions: 3.0.0
Reporter: Arpit Agarwal
Uncovered while fixing TestSymlinkLocalFsFileSystem on Windows.
This block of code deletes the symlink, the correct behavior is to do nothing.
{code:java}
try {
dstStatus = getFileLinkStatus(dst);
} catch (IOException e) {
dstStatus = null;
}
if (dstStatus != null) {
if (srcStatus.isDirectory() != dstStatus.isDirectory()) {
throw new IOException("Source " + src + " Destination " + dst
+ " both should be either file or directory");
}
if (!overwrite) {
throw new FileAlreadyExistsException("rename destination " + dst
+ " already exists.");
}
// Delete the destination that is a file or an empty directory
if (dstStatus.isDirectory()) {
FileStatus[] list = listStatus(dst);
if (list != null && list.length != 0) {
throw new IOException(
"rename cannot overwrite non empty destination directory " + dst);
}
}
delete(dst, false);
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira