-
Notifications
You must be signed in to change notification settings - Fork 48
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
Symbolic links are added as symlinks to the sources JAR instead of being followed #160
Comments
The reported crash isn't reproducible for me with:
This needs to be verified with Plexus Archiver. |
It’s not about the crash, this is just a funny side effect. I need to be able to have the maven-source-plugin follow symlinks when creating the sources JAR instead of adding the symlinks themselves into the JAR. This is what this is about. |
Likely both modes would be required. Retention and resolution. |
Yes, of course, hence the request to make it configurable. Per resource set, as @petr-ujezdsky suggested in his comment, would probably match best. |
Setting |
Some debugging later…
… it clearly shows that, despite…
…, the collection entry is still a symlink:
This is about the last file, a symbolic link:
I hope the fact that the amount of |
This might be due to plexus-io
… in
… and
… so the |
maybe advances debugging related to codehaus-plexus#160 (even if this fork is only concerned about following symlinks, not (yet) about making it configurable, since that is beyond my knowledge about this project)
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
I’m currently trying to implement this inside plexus-archiver in a configurable way (support both retention and resolution of symbolic links, as you said), but I have absolutely no idea how to then tie this in with the maven-source-plugin because the Maven Archiver configuration does not expose any plexus-archiver configuration, if there is any. @michael-o can you help me with that? |
My WIP branch on top of the 4.2.1 release (since that’s what the maven-source-plugin uses) now has this implemented, even extending the Even if this necessarily must wait for a new plexus-io release with that PR applied, review (also whether I’m on the correct path here) welcome… |
You need to pass this through all layers. All plugins using Maven Archiver expose XML configuration for it. |
Michael Osipov dixit:
You need to pass this through all layers.
I guessed so. Right now, it’s available in the Archiver interface
of plexus-archiver as of the current WIP.
All plugins using Maven Archiver expose XML configuration for it.
“For it” being the Maven Archiver, not the plexus-archiver, right?
I saw configuration/XML documentation for that.
I’m a bit overwhelmed should needing to completely add support to
configure plexus-archiver from the Maven Archiver need to be
created first…
bye,
//mirabilos
--
tarent solutions GmbH
Rochusstraße 2-4, D-53123 Bonn • http://www.tarent.de/
Tel: +49 228 54881-393 • Fax: +49 228 54881-235
HRB 5168 (AG Bonn) • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg
|
For me the topic of symlinks is at times quite confusing and hard to follow (no pun intended). It would help if we write down the requirements what is the desired behavior when the follow symbolic links. Plexus Archiver does have a complex system of including/excluding files, filenames mappings, overriding file attributes etc. Lets say we have the following directory structure (
So if follow links is p.s. @mirabilos please keep in mind that the follow sylinks change you mentioned was applied for Windows - platform on which Plexus Archiver didn't support symlinks at the time. That is why reverting the change on all system does not work as expected. I was intended for systems where symlinks are not supported not for ones where it is supported but should be followed. |
Plamen Totev dixit:
For me the topic of symlinks is at times quite confusing and hard to
follow (no pun intended). It would help if we write down the
requirements what is the desired behavior when the follow symbolic
links.
That, if a symlink is encountered, it is handled as if the pointed-to
thing were present in its place.
Lets say we have the following directory structure
(`->` denotes symlink)
```
/regularDir
/nestedDir
regularFileC
regularFileA
regurlarFileB
regularFileD
symLinkDir -> regularDir
symLinkA -> regularFileD
symLinkB -> regularDir/regularFileA
```
So if follow links is `true` then what should be the result.
/
regularDir/ directory
nestedDir/ directory
regularFileC file
regularFileA file
regurlarFileB file
regularFileD file
symLinkDir/ directory (uid/gid/mode/… copied from /regularDir)
nestedDir/ directory (uid/gid/mode/… copied from /regularDir/nestedDir)
regularFileC file, same contents as /regularDir/nestedDir/regularFileC
regularFileA file, same contents as /regularDir/regularFileA
regurlarFileB file, same contents as /regularDir/regurlarFileB
symLinkA file, same contents as /regularFileD
symLinkB file, same contents as /regularDir/regularFileA
One corner case you didn’t mention is symbolic links that don’t
resolve to an existing file (including directories and special
files) at the time of archival. They would, in follow symlinks
mode, be included into the archive as symlink (because that’s
what (I just checked) tar does in follow symlinks mode).
I admit I have _not_ tested that with these changes here yet.
For my use case, omitting them would be just as good.
p.s. @mirabilos please keep in mind that the follow sylinks change you
mentioned was applied for Windows - platform on which Plexus Archiver
didn't support symlinks at the time. That is why reverting the change
on all system does not work as expected. I was intended for systems
where symlinks are not supported not for ones where it is supported but
should be followed.
Yes, I assumed so, which is why I’ve prepared the PR for plexus-io
which would fix this.
Thanks,
//mirabilos
--
“It is inappropriate to require that a time represented as
seconds since the Epoch precisely represent the number of
seconds between the referenced time and the Epoch.”
-- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2
|
and with it latest maven-source-plugin if codehaus-plexus/plexus-archiver#160 is, indeed, fixed now…
I’ve got symbolic links in my resources (files that get reused in multiple places in a larger repository). They are correctly followed when creating the main binary JAR but the sources JAR contains the symbolic links themselves¹, which then point to nirvana (i.e. to outside the JAR).
In #47 (comment) it was suggested to make the “follow symlinks?” mode configurable. Implementing this would completely solve my issue if it is configurable in the necessary places; I believe that implementing it in the manner shown will fix it.
Related: https://issues.apache.org/jira/browse/MRESOURCES-237 where 3.x versions of the maven-resources-plugin cause similar problems by not following symlinks any more (which is why I’m pinning it to a 2.x version in my projects).
Fixing this in plexus-archiver might fix the maven-resources-plugin problem as well… unsure.
① Funnily enough, this even causes other software to crash when exploring the resulting archives…
The text was updated successfully, but these errors were encountered: