[ 
https://issues.apache.org/jira/browse/MSHADE-244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15828652#comment-15828652
 ] 

Diego Rivera commented on MSHADE-244:
-------------------------------------

It may well be.  I'm on Linux.  The code simply checks to see if the source 
file and the target file are the same in the invocation to replaceFile().  If 
they're the same, no copy is made to avoid clobbering (i.e. a 0-length file).

The rest of the patch is support code to help eliminate the possibility of 
mismatches (or false-matches) by ensuring each file is addressed by their 
canonical name (i.e. any symlinks or relative paths resolved, etc).

> Avoid file copy and replacement when source and target files are the same file
> ------------------------------------------------------------------------------
>
>                 Key: MSHADE-244
>                 URL: https://issues.apache.org/jira/browse/MSHADE-244
>             Project: Maven Shade Plugin
>          Issue Type: Bug
>    Affects Versions: 2.4.3
>            Reporter: Diego Rivera
>            Priority: Blocker
>         Attachments: shade.no-replace.patch
>
>
> When Shade::replaceFile() is invoked, and the source and target are the same, 
> no work should be performed since this can result in an attempt at copying 
> the same file upon itself, and the target will end up as a 0-byte file.
> Instead, the proposed patch (attached) adds a check to perform a best-attempt 
> intercept of that condition and avoid any unnecessary work.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to