[ 
https://issues.apache.org/jira/browse/FELIX-6837?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18136794#comment-18136794
 ] 

Paul Rütter commented on FELIX-6837:
------------------------------------

[~sahvx655wq] i think I covered this one in 
[https://github.com/apache/felix-dev/pull/589]

> 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
>            Priority: Major
>
> 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
(v10.3.26#10030026)

Reply via email to