Hi,

On 28/12/17 20:46, Stephen Connolly wrote:
But shouldn’t we be copying the last modified time stamp always anyway

I'm the same opinion...but that means in consequence that the test in plexus-archiver is not correct...cause it's waiting for a change in the last-modified time ...

Hm...

Kind regards
Karl Heinz Marbaise



On Thu 28 Dec 2017 at 14:52, Karl Heinz Marbaise <khmarba...@gmx.de <mailto:khmarba...@gmx.de>> wrote:

    Hi,

    after diving more into this..

    I found that if I upgrade plexus-utils to 3.1.0 in plexus-archiver the
    tests in plexus-archiver stuck completely...as I already observed (which
    I though was another cause)...

    https://travis-ci.org/codehaus-plexus/plexus-archiver/jobs/321821294

    So more diving into the details I realized that the following code in
    plexus-utils causes the issue:

    FileUtils.java:

          private static void doCopyFile( File source, File destination )
              throws IOException
          {
              // offload to operating system if supported
              if ( Java7Detector.isJava7() )
              {
                  doCopyFileUsingNewIO( source, destination );
              }
              else
              {
                  doCopyFileUsingLegacyIO( source, destination );
              }
          }

    The real issue is located in the implementation of doCopyFileUsingNewIO
    which uses:



          public static File copy( File source, File target )
              throws IOException
          {
              Path copy = Files.copy( source.toPath(), target.toPath(),
                         StandardCopyOption.REPLACE_EXISTING,
                         StandardCopyOption.COPY_ATTRIBUTES,
                         LinkOption.NOFOLLOW_LINKS );
              return copy.toFile();
          }

    and If I correctly understand the whole thing is the real cause of that
    based on the usage of StandardCopyOption.COPY_ATTRIBUTES which includes
    copying of the last-modified of the file...which means not to change the
    last-modified entry of the file and in result that is the reason of not
    changing it and the stucking of the unit test in plexus-archiver...(see
    travis build above)..


    After I have changed that and only use

          public static File copy( File source, File target )
              throws IOException
          {
              Path copy = Files.copy( source.toPath(), target.toPath(),
                         StandardCopyOption.REPLACE_EXISTING,
                         LinkOption.NOFOLLOW_LINKS );
              return copy.toFile();
          }

    it looks like working (see branch issue-fix):

    What Do you think?

    Kind regards
    Karl Heinz Marbaise

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to