Hadoop Common
  1. Hadoop Common
  2. HADOOP-10375

Local FS doesn't raise an error on mkdir() over a file

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.3.0
    • Fix Version/s: 0.21.0
    • Component/s: fs
    • Labels:
      None

      Description

      if you mkdir() on a path where there is already a file, the operation does
      not fail. Instead the operation returns 0.

      This is at odds with the behaviour of HDFS.

      HADOOP-6229 add the check for the parent dir not being a file, but something similar is needed for the destination dir itself

        Issue Links

          Activity

          Hide
          Steve Loughran added a comment -

          This may depend on Java 7 providing better APIs -a check and fail wouldn't be atomic

          Show
          Steve Loughran added a comment - This may depend on Java 7 providing better APIs -a check and fail wouldn't be atomic
          Hide
          Steve Loughran added a comment -

          ...actually, you could have the check for the destination being a file only run after the mkdir() operation returned false

          Show
          Steve Loughran added a comment - ...actually, you could have the check for the destination being a file only run after the mkdir() operation returned false
          Hide
          Andras Bokor added a comment -

          Steve Loughran,

          I think it was solved by HADOOP-9361.

          RawLocalFilesystem.java#mkdirsWithOptionalPermission
          if (p2f.exists() && !p2f.isDirectory()) {
                throw new FileNotFoundException("Destination exists" +
                        " and is not a directory: " + p2f.getCanonicalPath());
          }
          

          Do you agree?

          Show
          Andras Bokor added a comment - Steve Loughran , I think it was solved by HADOOP-9361 . RawLocalFilesystem.java#mkdirsWithOptionalPermission if (p2f.exists() && !p2f.isDirectory()) { throw new FileNotFoundException( "Destination exists" + " and is not a directory: " + p2f.getCanonicalPath()); } Do you agree?
          Hide
          Steve Loughran added a comment -

          yes, looks like I fixed it then and forgot about this JIRA. Closing as duplicate

          Show
          Steve Loughran added a comment - yes, looks like I fixed it then and forgot about this JIRA. Closing as duplicate

            People

            • Assignee:
              Steve Loughran
              Reporter:
              Steve Loughran
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development