ramanathan1504 commented on code in PR #4229:
URL: https://github.com/apache/logging-log4j2/pull/4229#discussion_r3894158597


##########
log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/PosixViewAttributeActionTest.java:
##########


Review Comment:
   `testSymbolicLinksAreFollowedWhenConfigured` passes with and without the 
change to 372, so the dangling-link case is the one that actually guards F1 — 
sketch below rather than a suggestion block, since it is a whole method:
   
   ```java
   @Test
   void testBrokenSymbolicLinkDoesNotAbortTheScan(@TempDir final Path tempDir) 
throws Exception {
       final Path baseDir = Files.createDirectory(tempDir.resolve("logs"));
       final Path regularFile = baseDir.resolve("app-1.log");
       Files.write(regularFile, "log".getBytes(StandardCharsets.UTF_8));
       Files.setPosixFilePermissions(regularFile, 
PosixFilePermissions.fromString("rw-------"));
       Files.createSymbolicLink(baseDir.resolve("app-0-broken.log"), 
tempDir.resolve("gone.txt"));
   
       final Configuration config = new BasicConfigurationFactory().new 
BasicConfiguration();
       final PosixViewAttributeAction action = 
PosixViewAttributeAction.newBuilder()
               .setBasePath(baseDir.toString())
               .setFollowLinks(true)
               .setMaxDepth(1)
               .setPathConditions(PathCondition.EMPTY_ARRAY)
               .setConfiguration(config)
               .setFilePermissionsString("rw-rw-rw-")
               .build();
   
       action.execute();
   
       assertEquals(
               "rw-rw-rw-",
               
PosixFilePermissions.toString(Files.getPosixFilePermissions(regularFile)),
               "a dangling link must not stop the scan");
   }
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to