Skip to content

FileDataStoreFactory fails inconsistently when setting permissions #1011

@elharo

Description

@elharo

Discovered in #927

  public FileDataStoreFactory(File dataDirectory) throws IOException {
    dataDirectory = dataDirectory.getCanonicalFile();
    this.dataDirectory = dataDirectory;
    // error if it is a symbolic link
    if (IOUtils.isSymbolicLink(dataDirectory)) {
      throw new IOException("unable to use a symbolic link: " + dataDirectory);
    }
    // create parent directory (if necessary)
    if (!dataDirectory.exists() && !dataDirectory.mkdirs()) {
      throw new IOException("unable to create directory: " + dataDirectory);
    }

    if (IS_WINDOWS) {
      setPermissionsToOwnerOnlyWindows(dataDirectory);
    } else {
      setPermissionsToOwnerOnly(dataDirectory);
    }
  }

setPermissionsToOwnerOnlyWindows and setPermissionsToOwnerOnly have several possible failure modes (i.e. exceptions thrown). Some of these are bubbled and some of these are eaten.

We need a consistent decision on whether failing to set permissions to owner only is or is not a fatal error. Whichever we decide we need to change the code to implement that on all paths.

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.semver: patchA minor bug fix or small change.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions