sahvx655-wq created FELIX-6837:
----------------------------------

             Summary: DirectoryWatcherTest.testInvalidTempDir may fail on file 
systems that do not enforce write-permission changes
                 Key: FELIX-6837
                 URL: https://issues.apache.org/jira/browse/FELIX-6837
             Project: Felix
          Issue Type: Bug
          Components: File Install
            Reporter: sahvx655-wq


The unit test {{DirectoryWatcherTest.testInvalidTempDir()}} assumes that 
revoking write permissions on a directory using {{parent.setWritable(false, 
false)}} will prevent further write access and cause {{DirectoryWatcher}} 
initialization to fail with an {{{}IllegalStateException{}}}.

 

{{File parent = new File("target/tmp");
parent.mkdirs();
parent.setWritable(false, false);

try \{
    dw = new DirectoryWatcher(new FileInstall(), props, mockBundleContext);
    fail("Expected an IllegalStateException");
} catch (IllegalStateException e) \{
    // expected
}}}

However, some file systems and operating systems do not reliably enforce 
directory write-permission restrictions for the directory owner (for example, 
common Windows/NTFS configurations). In such environments, {{setWritable(false, 
false)}} may not actually revoke write access, causing the test assumptions to 
be invalid and resulting in false test failures.

Before proceeding with the test, verify that write access has actually been 
revoked. If the filesystem does not enforce the permission change, skip or exit 
the test early instead of failing. This preserves test coverage on supported 
platforms while avoiding false negatives on unsupported file systems.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to