[
https://issues.apache.org/jira/browse/MENFORCER-390?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17789503#comment-17789503
]
ASF GitHub Bot commented on MENFORCER-390:
------------------------------------------
roadSurfer opened a new pull request, #297:
URL: https://github.com/apache/maven-enforcer/pull/297
This reverts the change from MENFORCER-364 as this led to a regressions with
symbolic links.
The fundamental issue is that there is no clean way to deal with
case-sensitivity as OSs can have multuple filesystems mounted that follow
different rules. Thus the simple `file.exists()` is, despite the limitations,
probably best. Those requiring more stringent checks writing their own handling.
Following this checklist to help us incorporate your
contribution quickly and easily:
- [ ] Make sure there is a [JIRA
issue](https://issues.apache.org/jira/browse/MENFORCER) filed
for the change (usually before you start working on it). Trivial
changes like typos do not
require a JIRA issue. Your pull request should address just this
issue, without
pulling in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line
and body.
- [ ] Format the pull request title like `[MENFORCER-XXX] - Fixes bug in
ApproximateQuantiles`,
where you replace `MENFORCER-XXX` with the appropriate JIRA issue.
Best practice
is to use the JIRA issue title in the pull request title and in the
first line of the
commit message.
- [ ] Write a pull request description that is detailed enough to
understand what the pull request does, how, and why.
- [ ] Run `mvn clean verify` to make sure basic checks pass. A more
thorough check will
be performed on your pull request automatically.
- [ ] You have run the integration tests successfully (`mvn -Prun-its clean
verify`).
If your pull request is about ~20 lines of code you don't need to sign an
[Individual Contributor License
Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the [Apache License Version 2.0, January
2004](http://www.apache.org/licenses/LICENSE-2.0)
you have to acknowledge this by using the following check-box.
- [ ] 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)
- [ ] In any other case, please file an [Apache Individual Contributor
License Agreement](https://www.apache.org/licenses/icla.pdf).
> "requireFilesExist" no longer handles non-canonical paths
> ---------------------------------------------------------
>
> Key: MENFORCER-390
> URL: https://issues.apache.org/jira/browse/MENFORCER-390
> Project: Maven Enforcer Plugin
> Issue Type: Bug
> Components: requireFilesExist, Standard Rules
> Affects Versions: 3.0.0
> Reporter: Gene Smith
> Priority: Major
>
> With the commit to resolve MENFORCER-364, the rule "requireFileExists" checks
> that the canonical path of a file is the same as the absolute path.
> But not all absolute paths are canonical.
> * absolute paths can involve symbolic links
> * and they are allowed to have parts which are relative
> ** {{/../}}
> ** {{/./}}{{}}{{}}{{}}
> And when it fails to handle a path, it can report that a file does not exist,
> even though the local system will resolve the path.
> A blunt solution might be three separate rules:
> * requireFileExists
> ** the provided path must resolve to a file (which may be a directory or
> link)
> * requireCanonicalFileExists
> ** the provided path must exist as a canonical file
> * requireCasesenstiveFileExists
> ** the provided path must file a file
> ** the file name must have the same case (upper//lower) as the
> ** the parts of the path from the file up must have the same case until they
> go through a symbolic link
> I have used the "nio" package to handle some of stuff before. I will add a
> comment with some java code I would start with. Since the outcome here is
> very dependent on the use case you pick, the java will be "meta code" with
> ??? where you have to know the use case to know the outcome.
> but basically, with "nio" you can march up a path checking for symbolic links
> and such.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)