Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-10019 make symlinks production-ready
  3. HADOOP-9819

FileSystem#rename is broken, deletes target when renaming link to itself

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.0.0-alpha1
    • None
    • fs
    • None

    Description

      Uncovered while fixing TestSymlinkLocalFsFileSystem on Windows.

      This block of code deletes the symlink, the correct behavior is to do nothing.

          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);
      

      Attachments

        1. HADOOP-9819.04.patch
          3 kB
          Andras Bokor
        2. HADOOP-9819.03.patch
          3 kB
          Andras Bokor
        3. HADOOP-9819.02.patch
          2 kB
          Andras Bokor
        4. HADOOP-9819.01.patch
          2 kB
          Andras Bokor

        Activity

          People

            boky01 Andras Bokor
            arp Arpit Agarwal
            Votes:
            0 Vote for this issue
            Watchers:
            14 Start watching this issue

            Dates

              Created:
              Updated: