You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Benjamin Bentmann (JIRA)" <ji...@codehaus.org> on 2007/12/21 11:04:57 UTC

[jira] Created: (MNG-3331) Normalize paths to sub modules

Normalize paths to sub modules
------------------------------

                 Key: MNG-3331
                 URL: http://jira.codehaus.org/browse/MNG-3331
             Project: Maven 2
          Issue Type: Improvement
          Components: Reactor and workspace
    Affects Versions: 2.0.8
            Reporter: Benjamin Bentmann
         Attachments: normalized-module-file.patch

When collecting the sub modules during a reactor build, the path to the module POMs should always be normalized. Currently, this happens only on a Windows platform via File.getCanonicalFile(). The attached patch adds normalization (but not canonicalization) for other platforms, too.

The motivation: Consider a multi module project with the following directory structure:
  project/
    project-parent/
    project-module/
such that the parent POM in project-parent will contain
   <module>../project-module</module>
to reference the sub module. Simple string/path concatenation will therefore deliver a path like
   {SNIP}/project-parent/../project-module
for the sub module. Having
  {SNIP}/project-module 
instead is surely better, and may it be just for nice log output.

However, certain plugins/tools try to detect symlinks by comparing the canonicalized path with the absolute path of a file. While users of DirectoryScanner are usually fine because this class always canonicalizes the base directory before the check, code that does not know about a base directory but simply gets a single file will erroneously detect a symlink because ".." gets removed during canonicalization.

This actually happens with the CpdReport of the maven-pmd-plugin. See [CPD.addFile(int, File)|http://pmd.svn.sourceforge.net/viewvc/pmd/trunk/pmd/src/net/sourceforge/pmd/cpd/CPD.java?view=markup] for the cause, i.e. the code near line 97 where it prints "Skipping {file} since it appears to be a symlink".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MNG-3331) Normalize paths to sub modules

Posted by "John Casey (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-3331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John Casey updated MNG-3331:
----------------------------

    Assignee: John Casey  (was: Milos Kleint)

> Normalize paths to sub modules
> ------------------------------
>
>                 Key: MNG-3331
>                 URL: http://jira.codehaus.org/browse/MNG-3331
>             Project: Maven 2
>          Issue Type: Improvement
>          Components: Reactor and workspace
>    Affects Versions: 2.0.8
>            Reporter: Benjamin Bentmann
>            Assignee: John Casey
>             Fix For: 2.0.9, 2.1-alpha-1
>
>         Attachments: normalized-module-file.patch
>
>
> When collecting the sub modules during a reactor build, the path to the module POMs should always be normalized. Currently, this happens only on a Windows platform via File.getCanonicalFile(). The attached patch adds normalization (but not canonicalization) for other platforms, too.
> The motivation: Consider a multi module project with the following directory structure:
>   project/
>     project-parent/
>     project-module/
> such that the parent POM in project-parent will contain
>    <module>../project-module</module>
> to reference the sub module. Simple string/path concatenation will therefore deliver a path like
>    {SNIP}/project-parent/../project-module
> for the sub module. Having
>   {SNIP}/project-module 
> instead is surely better, and may it be just for nice log output.
> However, certain plugins/tools try to detect symlinks by comparing the canonicalized path with the absolute path of a file. While users of DirectoryScanner are usually fine because this class always canonicalizes the base directory before the check, code that does not know about a base directory but simply gets a single file will erroneously detect a symlink because ".." gets removed during canonicalization.
> This actually happens with the CpdReport of the maven-pmd-plugin. See [CPD.addFile(int, File)|http://pmd.svn.sourceforge.net/viewvc/pmd/trunk/pmd/src/net/sourceforge/pmd/cpd/CPD.java?view=markup] for the cause, i.e. the code near line 97 where it prints "Skipping {file} since it appears to be a symlink".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MNG-3331) Normalize paths to sub modules

Posted by "Vincent Siveton (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-3331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vincent Siveton updated MNG-3331:
---------------------------------

    Fix Version/s: 2.1-alpha-1
                   2.0.9

> Normalize paths to sub modules
> ------------------------------
>
>                 Key: MNG-3331
>                 URL: http://jira.codehaus.org/browse/MNG-3331
>             Project: Maven 2
>          Issue Type: Improvement
>          Components: Reactor and workspace
>    Affects Versions: 2.0.8
>            Reporter: Benjamin Bentmann
>             Fix For: 2.0.9, 2.1-alpha-1
>
>         Attachments: normalized-module-file.patch
>
>
> When collecting the sub modules during a reactor build, the path to the module POMs should always be normalized. Currently, this happens only on a Windows platform via File.getCanonicalFile(). The attached patch adds normalization (but not canonicalization) for other platforms, too.
> The motivation: Consider a multi module project with the following directory structure:
>   project/
>     project-parent/
>     project-module/
> such that the parent POM in project-parent will contain
>    <module>../project-module</module>
> to reference the sub module. Simple string/path concatenation will therefore deliver a path like
>    {SNIP}/project-parent/../project-module
> for the sub module. Having
>   {SNIP}/project-module 
> instead is surely better, and may it be just for nice log output.
> However, certain plugins/tools try to detect symlinks by comparing the canonicalized path with the absolute path of a file. While users of DirectoryScanner are usually fine because this class always canonicalizes the base directory before the check, code that does not know about a base directory but simply gets a single file will erroneously detect a symlink because ".." gets removed during canonicalization.
> This actually happens with the CpdReport of the maven-pmd-plugin. See [CPD.addFile(int, File)|http://pmd.svn.sourceforge.net/viewvc/pmd/trunk/pmd/src/net/sourceforge/pmd/cpd/CPD.java?view=markup] for the cause, i.e. the code near line 97 where it prints "Skipping {file} since it appears to be a symlink".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (MNG-3331) Normalize paths to sub modules

Posted by "John Casey (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-3331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John Casey closed MNG-3331.
---------------------------

    Resolution: Fixed

fair enough. good catch.

> Normalize paths to sub modules
> ------------------------------
>
>                 Key: MNG-3331
>                 URL: http://jira.codehaus.org/browse/MNG-3331
>             Project: Maven 2
>          Issue Type: Improvement
>          Components: Reactor and workspace
>    Affects Versions: 2.0.8
>            Reporter: Benjamin Bentmann
>            Assignee: John Casey
>             Fix For: 2.0.9, 2.1-alpha-1
>
>         Attachments: normalized-module-file.patch
>
>
> When collecting the sub modules during a reactor build, the path to the module POMs should always be normalized. Currently, this happens only on a Windows platform via File.getCanonicalFile(). The attached patch adds normalization (but not canonicalization) for other platforms, too.
> The motivation: Consider a multi module project with the following directory structure:
>   project/
>     project-parent/
>     project-module/
> such that the parent POM in project-parent will contain
>    <module>../project-module</module>
> to reference the sub module. Simple string/path concatenation will therefore deliver a path like
>    {SNIP}/project-parent/../project-module
> for the sub module. Having
>   {SNIP}/project-module 
> instead is surely better, and may it be just for nice log output.
> However, certain plugins/tools try to detect symlinks by comparing the canonicalized path with the absolute path of a file. While users of DirectoryScanner are usually fine because this class always canonicalizes the base directory before the check, code that does not know about a base directory but simply gets a single file will erroneously detect a symlink because ".." gets removed during canonicalization.
> This actually happens with the CpdReport of the maven-pmd-plugin. See [CPD.addFile(int, File)|http://pmd.svn.sourceforge.net/viewvc/pmd/trunk/pmd/src/net/sourceforge/pmd/cpd/CPD.java?view=markup] for the cause, i.e. the code near line 97 where it prints "Skipping {file} since it appears to be a symlink".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Reopened: (MNG-3331) Normalize paths to sub modules

Posted by "Benjamin Bentmann (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-3331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Bentmann reopened MNG-3331:
------------------------------------


My patch intentionally performed {{URI.normalize()}} for Non-Windows and ONLY for Non-Windows OS. Your recent commit r618708 now calls this method in all cases which is
# unnecessary on a Windows platform since you already call {{[File.getCanonicalFile()|http://java.sun.com/javase/6/docs/api/java/io/File.html#getCanonicalPath()]}} here and is
# dangerous on a Windows platform since it destroys UNC paths (see [Sun Bug 4723726|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4723726]

> Normalize paths to sub modules
> ------------------------------
>
>                 Key: MNG-3331
>                 URL: http://jira.codehaus.org/browse/MNG-3331
>             Project: Maven 2
>          Issue Type: Improvement
>          Components: Reactor and workspace
>    Affects Versions: 2.0.8
>            Reporter: Benjamin Bentmann
>            Assignee: John Casey
>             Fix For: 2.0.9, 2.1-alpha-1
>
>         Attachments: normalized-module-file.patch
>
>
> When collecting the sub modules during a reactor build, the path to the module POMs should always be normalized. Currently, this happens only on a Windows platform via File.getCanonicalFile(). The attached patch adds normalization (but not canonicalization) for other platforms, too.
> The motivation: Consider a multi module project with the following directory structure:
>   project/
>     project-parent/
>     project-module/
> such that the parent POM in project-parent will contain
>    <module>../project-module</module>
> to reference the sub module. Simple string/path concatenation will therefore deliver a path like
>    {SNIP}/project-parent/../project-module
> for the sub module. Having
>   {SNIP}/project-module 
> instead is surely better, and may it be just for nice log output.
> However, certain plugins/tools try to detect symlinks by comparing the canonicalized path with the absolute path of a file. While users of DirectoryScanner are usually fine because this class always canonicalizes the base directory before the check, code that does not know about a base directory but simply gets a single file will erroneously detect a symlink because ".." gets removed during canonicalization.
> This actually happens with the CpdReport of the maven-pmd-plugin. See [CPD.addFile(int, File)|http://pmd.svn.sourceforge.net/viewvc/pmd/trunk/pmd/src/net/sourceforge/pmd/cpd/CPD.java?view=markup] for the cause, i.e. the code near line 97 where it prints "Skipping {file} since it appears to be a symlink".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (MNG-3331) Normalize paths to sub modules

Posted by "John Casey (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-3331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John Casey closed MNG-3331.
---------------------------

    Resolution: Fixed

Patch applied. Thanks!. Also, added integration tests to make sure that module paths (with spaces and with relative directory references) don't cause problems with basic  maven functionality.

> Normalize paths to sub modules
> ------------------------------
>
>                 Key: MNG-3331
>                 URL: http://jira.codehaus.org/browse/MNG-3331
>             Project: Maven 2
>          Issue Type: Improvement
>          Components: Reactor and workspace
>    Affects Versions: 2.0.8
>            Reporter: Benjamin Bentmann
>            Assignee: John Casey
>             Fix For: 2.0.9, 2.1-alpha-1
>
>         Attachments: normalized-module-file.patch
>
>
> When collecting the sub modules during a reactor build, the path to the module POMs should always be normalized. Currently, this happens only on a Windows platform via File.getCanonicalFile(). The attached patch adds normalization (but not canonicalization) for other platforms, too.
> The motivation: Consider a multi module project with the following directory structure:
>   project/
>     project-parent/
>     project-module/
> such that the parent POM in project-parent will contain
>    <module>../project-module</module>
> to reference the sub module. Simple string/path concatenation will therefore deliver a path like
>    {SNIP}/project-parent/../project-module
> for the sub module. Having
>   {SNIP}/project-module 
> instead is surely better, and may it be just for nice log output.
> However, certain plugins/tools try to detect symlinks by comparing the canonicalized path with the absolute path of a file. While users of DirectoryScanner are usually fine because this class always canonicalizes the base directory before the check, code that does not know about a base directory but simply gets a single file will erroneously detect a symlink because ".." gets removed during canonicalization.
> This actually happens with the CpdReport of the maven-pmd-plugin. See [CPD.addFile(int, File)|http://pmd.svn.sourceforge.net/viewvc/pmd/trunk/pmd/src/net/sourceforge/pmd/cpd/CPD.java?view=markup] for the cause, i.e. the code near line 97 where it prints "Skipping {file} since it appears to be a symlink".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira