hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andras Bokor (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HADOOP-9819) FileSystem#rename is broken, deletes target when renaming link to itself
Date Tue, 10 May 2016 13:08:12 GMT

     [ https://issues.apache.org/jira/browse/HADOOP-9819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Andras Bokor updated HADOOP-9819:
---------------------------------
    Attachment: HADOOP-9819.02.patch

[~stevel@apache.org], [~cnauroth],

It is another rename issue.
I chose the same solution as in {{AbstractFileSystem}}:
# Remain in sync with {{AbstractFileSystem}}
# So far we deleted the file then threw {{FileNotFoundException}}. From now on we do not delete
the file but throw a {{FileAlreadyExistsException}} (as other filesystems).

Another note:
I deleted the related test since the same test in {{SymlinkBaseTest}} is good. It would be
a dup.

Could you please review/merge? [^HADOOP-9819.02.patch]

> 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: Sub-task
>          Components: fs
>    Affects Versions: 3.0.0
>            Reporter: Arpit Agarwal
>            Assignee: Andras Bokor
>         Attachments: HADOOP-9819.01.patch, HADOOP-9819.02.patch
>
>
> 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 was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Mime
View raw message