ramanathan1504 commented on PR #4229:
URL: https://github.com/apache/logging-log4j2/pull/4229#issuecomment-5478370893
@jmestwa-coder thanks — the `FileUtils` revert, the javadoc paragraph, the
old test removal and the changelog wording all landed exactly right;
`FileUtils.java` and `FileUtilsTest.java` are now byte-identical to `2.x`,
`spotless:check` is green and `PosixViewAttributeActionTest` + `FileUtilsTest`
pass 10/10 here.
Two things, and the first one is my fault.
1. **My suggestion on `PosixViewAttributeAction.java:372` was wrong — please
back it out.** I claimed the guard never fires under `followLinks="true"`, and
it does not, but that is precisely the behaviour you want: with `FOLLOW_LINKS`
a valid symlink is already `stat`-resolved before `visitFile` sees it, so it
gets followed either way. The only case `!isFollowSymbolicLinks() &&` actually
changes is a *dangling* link, which the plain guard skipped harmlessly and the
gated version now walks into. One broken link and one real `app-1.log` in
`basePath` with `followLinks="true"`:
```
with !isFollowSymbolicLinks() && :
execute() threw java.nio.file.NoSuchFileException: .../app-0-broken.log
app-1.log perms = rw------- <- never updated
without (plain attrs.isSymbolicLink()):
execute() returned normally
app-1.log perms = rw-rw-rw- <- updated
```
`visitFile` throws out of `walkFileTree`, so one stale link stops the whole
scan. Suggestion on the line to restore it.
2. **`testSymbolicLinksAreFollowedWhenConfigured` passes with and without
the fix** — I reverted line 372 and it stayed green, same reason as above.
Worth keeping as documentation, but it does not guard anything. The broken-link
case does: it fails on the gated version and passes on the plain one. Sketch
left on the test file.
Sorry for the round trip on 372 — that one was mine to get right.
--
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]