Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 26, 2025

The followSymlinks flag only affected directory traversal, not file symlink resolution. When encountering a symlink to a file, PlexusIoFileResourceCollection always returned it as a symlink resource regardless of the flag value.

Changes

  • PlexusIoFileResourceCollection.addResources(): Pass isFollowingSymLinks() to FileAttributes constructor to control symlink resolution for files
  • PlexusIoFileResourceCollectionSymlinkTest: Add test coverage for file and directory symlink handling with both flag settings

Behavior

With followSymlinks=true (default):

collection.setFollowingSymLinks(true);
PlexusIoResource resource = collection.getResources().next();
resource.isSymbolicLink();  // false - dereferenced to target
resource.getSize();         // target file size

With followSymlinks=false:

collection.setFollowingSymLinks(false);
PlexusIoResource resource = collection.getResources().next();
resource.isSymbolicLink();  // true - preserved as symlink

Addresses codehaus-plexus/plexus-archiver#160

Original prompt

This section details on the original issue you should resolve

<issue_title>Support following symbolic links to files as well</issue_title>
<issue_description>From my analysis of the problem in codehaus-plexus/plexus-archiver#160 (comment) changes in plexus-io are needed to support following symbolic links to files (not directories).

We can track the plexus-io part here.</issue_description>

Comments on the Issue (you are @copilot in this section)

@plamentotev While it may not be intuitive I think `PlexusIoFileResourceCollection` works as intended. This collection return a collection of files as they are on the file system. This includes symlinks. It is up to the caller to decide how to handle symlinks. The flag affect only dirs as it affects which files are going to be included.

I think it would be better to keep the collection as it is, but while compressing Plexus Archiver should follow the symlink instead of adding it to the archive..</comment_new>
<comment_new>@plamentotev
Now that I had time to look again on the pull request it does make sense. I'm only concerned that it changes the default behavior of a code that existed for quite some time. Callers that haven't set the follow sym links flag at all will not get the sym links. That may break existing applications without them even knowing they are affected by the change.</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add support for following symbolic links to files Support following symbolic links to files Oct 26, 2025
Copilot finished work on behalf of slachiewicz October 26, 2025 12:58
Copilot AI requested a review from slachiewicz October 26, 2025 12:58
@slachiewicz slachiewicz marked this pull request as ready for review October 26, 2025 13:08
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

2 participants