[JBoss Microcontainer Development] New message: "Re: VFS3 and symlinks"
by John Bailey
JBoss development,
A new message was posted in the thread "VFS3 and symlinks":
http://community.jboss.org/message/528610#528610
Author : John Bailey
Profile : http://community.jboss.org/people/johnbailey
Message:
--------------------------------------------------------------
Another possible solution (that I have not proven or even finished thinking about) is to detect a symlinked path at mount time and mount in both the symlinked path and the canonical path. You wouldn't really need to mount multiple filesystems, as it would really be the same filesystem mounted in multiple locations in the VFS. This would allow either path to be used from that point forward and both paths would resolve to the same filesysem entries. There would be no need to perform excessive getCanonicalFile calls once the mount has occurred.
Some things to think about:
1. This only works if the mount occurs from the symlinked path however
2. It would need to make sure the canonical path is not currently mounted with another filesystem
3. Unmounting would need to remove both
Just a thought.
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/528610#528610
14 years, 10 months
[JBoss Microcontainer Development] New message: "Re: CL requirements and domains not in-synch"
by Adrian Brock
JBoss development,
A new message was posted in the thread "CL requirements and domains not in-synch":
http://community.jboss.org/message/528588#528588
Author : Adrian Brock
Profile : http://community.jboss.org/people/adrian@jboss.org
Message:
--------------------------------------------------------------
I assume you mean the commented out test? It looks like it is working as it is supposed to out-of-the-box.
The purpose of Hierarchical domains is to reproduce what was done in JBoss4.x with the Hierarchical loader repositories.
So by default they work the same way.
The jboss-classloading.xml only lets you specify parent-first=true/false,
i.e. ParentPolicy.BEFORE or ParentPolicy.AFTER_BUT_JAVA_BEFORE
If you want more control on what is visible in the parent,
then you need to create the domain manually to specify your filter.
e.g. Your test works if I change it as follows:
[ejort@warjort jboss-cl]$ svn diff classloading/src/test/java/org/jboss/test/classloading/dependency/test/HierarchicalDomainUnitTestCase.java
Index: classloading/src/test/java/org/jboss/test/classloading/dependency/test/HierarchicalDomainUnitTestCase.java
===================================================================
--- classloading/src/test/java/org/jboss/test/classloading/dependency/test/HierarchicalDomainUnitTestCase.java (revision 101491)
+++ classloading/src/test/java/org/jboss/test/classloading/dependency/test/HierarchicalDomainUnitTestCase.java (working copy)
@@ -23,6 +23,7 @@
import junit.framework.Test;
import org.jboss.classloader.spi.ClassLoaderSystem;
+import org.jboss.classloader.spi.ParentPolicy;
import org.jboss.classloading.spi.dependency.policy.mock.MockClassLoadingMetaData;
import org.jboss.classloading.spi.metadata.ClassLoadingMetaDataFactory;
import org.jboss.classloading.spi.metadata.ExportAll;
@@ -478,7 +479,8 @@
public void testExplicitRequirementsInNewDomain() throws Exception
{
- // FIXME - testExplicitRequirementsInDomain("SomeNewDomain");
+ system.createAndRegisterDomain("SomeNewDomain", ParentPolicy.BEFORE_BUT_JAVA_ONLY, system.getDefaultDomain());
+ testExplicitRequirementsInDomain("SomeNewDomain");
}
protected void testExplicitRequirementsInDomain(String domain) throws Exception
But in that case, there is little point in the hierarchical domain. ;-)
system.createAndRegisterDomain("SomeNewDomain", ParentPolicy.BEFORE_BUT_JAVA_ONLY);
would give you a new top-level domain and also make your test work.
NOTE: In real life, you would use ParentPolicy.BEFORE in the last example,
but if you used that in this test, it would load the support classes from the classpath
rather than the Mock classloader. :-)
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/528588#528588
14 years, 10 months
[JBoss Microcontainer Development] New message: "Re: VFS3 and symlinks"
by Ales Justin
JBoss development,
A new message was posted in the thread "VFS3 and symlinks":
http://community.jboss.org/message/528584#528584
Author : Ales Justin
Profile : http://community.jboss.org/people/alesj
Message:
--------------------------------------------------------------
> Upon further thought I guess it could be possible for someone to feed the canonical File/URL in through the profileservice or admin console, which could then cause issues as it would not match the deployment URL.
>
> So maybe we need something.
I might be too "paranoid" and I agree the test doesn't really show the real-life use case.
But like you said, we might need something or at least be ready if it turns out there is a valid need for this.
Another (extreme) scenario I have in mind is the following use case.
Let's say we already mounted stuff for canonical paths.
But a user doesn't know about the real path (as it's ugly, hard to remember, ...), but he does know the nice symlinks.
And he tries to use that one to navigate through his resources -- resulting in a failure, as we only know the canonical path.
This one is quite ugly to get right, as we would probably always have to re-create the full path,
transform it into canonical, and only then get the child.
Doubt it's worth doing this -- ugly and slow code. No need to repeat some of the mistakes from VFS2. :-)
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/528584#528584
14 years, 10 months
[JBoss Microcontainer Development] New message: "Re: VFS3 and symlinks"
by John Bailey
JBoss development,
A new message was posted in the thread "VFS3 and symlinks":
http://community.jboss.org/message/528571#528571
Author : John Bailey
Profile : http://community.jboss.org/people/johnbailey
Message:
--------------------------------------------------------------
I agree that having it force canonical every time would be a bit expensive for something that will occur somewhat infrequently. I have however seen symlinks used in large infrastructures in the past.
What I question is why we need to force it. As long as all accesses to the file via URL use the same path (either symlinked or canonical), I don't think there is a problem. The problem that existed in VFS2 with AS5 was specific to the way the URL was being manipulated when the VFS cache was creating permanent roots. I don't think the same problem would exist in the current VFS3 setup.
What is being tested in the VFS symlink test does not seem like a real world test to me. Since there would be no reason for someone to create the URL expecting the inner archive to be a valid path to use as it doesn't exist on the filesystem unless they are using the VFS. I could only see them getting that URL through the VFS in some way and then manipulating it after.
The reason I fail to see this scenario happening in real life is there is an assumption someone is going to take a URL from a VirtualFile from within a zip filesystem and turn it into a File object to then get the canonical file. This will already not work for zip filesystems as the initial File does not actually exist. on the real filesystem whether symlinked or not. The other option is someone has to take a URL run through a process to convert it to a canonical URL and then use that for mounting, and then later on someone is going to ask for files using the symlinked URL. I can't see any reason for symlinked URLs to just be magiced up later in the execution.
I am sure I am missing something, but it seems like as long as nothing within AS takes URLs and manipulates them to get the canonical URL we should be fine. But maybe just to be sure we need to come up with some kind of solution.
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/528571#528571
14 years, 10 months
[JBoss Microcontainer Development] New message: "Re: VFS3 and symlinks"
by Ales Justin
JBoss development,
A new message was posted in the thread "VFS3 and symlinks":
http://community.jboss.org/message/528555#528555
Author : Ales Justin
Profile : http://community.jboss.org/people/alesj
Message:
--------------------------------------------------------------
> Just want to say that if this is the correct fix, it should not be optional.
>
I don't see any other way of fixing this -- force all paths to be canonical.
But I would expect that this call is not cheap, asking the underlying FS for canonical path.
And since 99% of users are not using symlinks (at least that's what I would expect), making this force optional makes sense.
> No point in allowing configurations which aren't valid.
I don't get this.
Unfortunately I think the problem is even bigger than just VFS::getChild.
My guess is that even calls to VirtualFile::getChild are due to fail with symlinked path?
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/528555#528555
14 years, 10 months