Details

    • Flags:
      Patch

      Description

      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) for the cause, i.e. the code near line 97 where it prints "Skipping

      {file}

      since it appears to be a symlink".

        Activity

        Benjamin Bentmann created issue -
        Siveton Vincent made changes -
        Field Original Value New Value
        Fix Version/s 2.1-alpha-1 [ 13143 ]
        Fix Version/s 2.0.9 [ 13801 ]
        Milos Kleint made changes -
        Assignee Milos Kleint [ mkleint ]
        John Casey made changes -
        Assignee Milos Kleint [ mkleint ] John Casey [ jdcasey ]
        Hide
        John Casey added a comment -

        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.

        Show
        John Casey added a comment - 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.
        John Casey made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Hide
        Benjamin Bentmann added a comment -

        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

        1. unnecessary on a Windows platform since you already call File.getCanonicalFile() here and is
        2. dangerous on a Windows platform since it destroys UNC paths (see Sun Bug 4723726
        Show
        Benjamin Bentmann added a comment - 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() here and is dangerous on a Windows platform since it destroys UNC paths (see Sun Bug 4723726
        Benjamin Bentmann made changes -
        Status Closed [ 6 ] Reopened [ 4 ]
        Resolution Fixed [ 1 ]
        Hide
        John Casey added a comment -

        fair enough. good catch.

        Show
        John Casey added a comment - fair enough. good catch.
        John Casey made changes -
        Status Reopened [ 4 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 08:49:45 UTC 2015 [ 1428223785911 ]
        Mark Thomas made changes -
        Workflow jira [ 12713771 ] Default workflow, editable Closed status [ 12753553 ]
        Mark Thomas made changes -
        Patch Submitted Yes [ 10763 ]
        Flags Patch [ 10430 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 21:45:26 UTC 2015 [ 1428270326204 ]
        Mark Thomas made changes -
        Workflow jira [ 12952254 ] Default workflow, editable Closed status [ 12989612 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        46d 7h 30m 1 John Casey 05/Feb/08 11:34
        Closed Closed Reopened Reopened
        49m 52s 1 Benjamin Bentmann 05/Feb/08 12:24
        Reopened Reopened Closed Closed
        7m 15s 1 John Casey 05/Feb/08 12:31

          People

          • Assignee:
            John Casey
            Reporter:
            Benjamin Bentmann
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development