Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support following symbolic links to files #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mirabilos
Copy link

This implements the necessary support to allow plexus-archiver to archive the contents of symlinks (instead of the symbolic links themselves), depending on the (already-extant) follow-symlinks flag.

Closes: #37

I’ve tested this in a patch against 3.2.0 which slightly differs from this patch against git master, but I believe there to be no issues.

This implements the necessary support to allow plexus-archiver to
archive the contents of symlinks (instead of the symbolic links
themselves), depending on the (already-extant) follow-symlinks flag.

Closes: codehaus-plexus#37

Signed-off-by: mirabilos <[email protected]>
mirabilos added a commit to qvest-digital/plexus-archiver that referenced this pull request Jan 8, 2021
default is still true here, will be false when submitting upstream

REQUIRES a version of plexus-io with the following PR merged:
codehaus-plexus/plexus-io#38

advances codehaus-plexus#160
even if I don’t know how to make this configurable from Maven
Path p = f.toPath();
if ( isFollowingSymLinks() )
{
p = p.toRealPath();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think f.getCanonicalPath() would do the same without introducing Path.

@@ -158,8 +159,13 @@ private void addResources( List<PlexusIoResource> result, String[] resources )
{
String sourceDir = name.replace( '\\', '/' );
File f = new File( dir, sourceDir );
Path p = f.toPath();
if ( isFollowingSymLinks() )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true by default isFollowingSymLinks. I'm a bit concerned that this change would change the behavior of existing applications. I know the existing behavior is odd, but it was existing for quite some time and maybe there are applications that depend on it. Do you think adding additional flag would made sense? In general I hate fix bug kind of flags, but this code was here for quite some time and maybe there is code out there depending on PlexusIoFileResourceCollection not following symlinks by default.

@plamentotev
Copy link
Member

Adding a test case would be great if you have the time.

@mirabilos thanks for the contribution. The symbolic link handling in Plexus IO and Plexus Archiver could be improved, it is great to see contributors helping with that,

@mirabilos
Copy link
Author

mirabilos commented Apr 18, 2021 via email

@mirabilos
Copy link
Author

mirabilos commented Apr 18, 2021 via email

@mirabilos
Copy link
Author

mirabilos commented Apr 18, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support following symbolic links to *files* as well
3 participants