slawekjaranowski opened a new pull request, #1031:
URL: https://github.com/apache/maven-enforcer/pull/1031

   Fixes #501
   
   `requireFilesExist` reports an existing symbolic link as missing. The case 
check
   added for #477 compares the configured file name with the one from
   `getCanonicalFile()`, which resolves a link to its target, so a link whose 
name
   differs from its target name — the normal case — never matches.
   
   The `..` and `.` part of #501 was already fixed in #1011; this covers the
   remaining symbolic link part.
   
   ### How
   
   `toRealPath(NOFOLLOW_LINKS)` replaces `getCanonicalFile()`. It still 
corrects the
   case on a case-insensitive filesystem and still collapses `..` and `.`, but
   leaves the link itself alone:
   
   | | `getCanonicalFile()` | `toRealPath(NOFOLLOW_LINKS)` |
   |---|---|---|
   | symbolic link | ❌ reported missing | ✅ found |
   | `POM.xml` vs `pom.xml` | ✅ rejected | ✅ rejected |
   | path through `..` | ✅ found | ✅ found |
   
   The check moves to `AbstractRequireFiles` behind a shared 
`fileExists(File)`, so
   `requireFilesExist`, `requireFilesDontExist` and `requireFilesSize` share one
   notion of an existing file.
   
   ### Behavioural change
   
   On a case-insensitive filesystem (Windows, default macOS) a file whose name
   differs only in case is now consistently treated as a different file:
   
   - `requireFilesDontExist` no longer fails on it
   - `requireFilesSize` reports it as missing instead of measuring a different 
file
   
   On a case-sensitive filesystem nothing changes. The three rule pages document
   this.
   
   ### Credit
   
   The symbolic link tests and the relative path IT come from #297 by 
@roadSurfer.
   That PR proposed reverting #477 entirely; this keeps the case check and fixes
   the link handling instead, so #297 can be closed.
   
   - [x] Your pull request should address just one issue, without pulling in 
other changes.
   - [x] Write a pull request description that is detailed enough to understand 
what the pull request does, how, and why.
   - [x] Each commit in the pull request should have a meaningful subject line 
and body.
   - [x] Write unit tests that match behavioral changes, where the tests fail 
if the changes to the runtime are not applied.
   - [x] Run `mvn verify` to make sure basic checks pass.
   - [x] You have run the integration tests successfully (`mvn -Prun-its 
verify`).
   - [x] I hereby declare this contribution to be licenced under the [Apache 
License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   


-- 
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