Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileDataStoreFactory fails inconsistently when setting permissions #1011

Closed
elharo opened this issue Mar 24, 2020 · 1 comment · Fixed by #1012
Closed

FileDataStoreFactory fails inconsistently when setting permissions #1011

elharo opened this issue Mar 24, 2020 · 1 comment · Fixed by #1012
Assignees
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. 🚨 This issue needs some love. semver: patch A minor bug fix or small change. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@elharo
Copy link
Contributor

elharo commented Mar 24, 2020

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.

@elharo elharo added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. semver: patch A minor bug fix or small change. labels Mar 24, 2020
@elharo
Copy link
Contributor Author

elharo commented Mar 24, 2020

decision: always fail

@elharo elharo self-assigned this Mar 24, 2020
@yoshi-automation yoshi-automation added 🚨 This issue needs some love. and removed 🚨 This issue needs some love. labels Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. 🚨 This issue needs some love. semver: patch A minor bug fix or small change. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants