You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Bertrand Delacretaz (JIRA)" <ji...@apache.org> on 2016/12/07 08:38:58 UTC

[jira] [Commented] (SLING-6350) MountByFS does not work if the Provider Root mounts below /libs or /apps and has more than 2 slashes

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

Bertrand Delacretaz commented on SLING-6350:
--------------------------------------------

Good catch, thanks for this Sandro!

I'm not familiar with that code but I have added a few tests to clarify the behavior in http://svn.apache.org/r1773021 - a few of those product unexpected results, see TODOs there, does that match your observations?

I'm wondering if we really need that slash counting code, it looks quite complicated. Can't we just replace {{**}} in the specified pattern with a regex that matches 0..N path elements? And maybe extract the extension if present in the incoming pattern and check it separately.

It looks like the slash counting code was introduced fairly recently by http://svn.apache.org/r1765329 for SLING-6161 - that's been released in o.a.s.api 2.15.0 so we need to stay compatible with that.

> MountByFS does not work if the Provider Root mounts below /libs or /apps and has more than 2 slashes
> ----------------------------------------------------------------------------------------------------
>
>                 Key: SLING-6350
>                 URL: https://issues.apache.org/jira/browse/SLING-6350
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: API 2.15.0
>            Reporter: Sandro Boehme
>             Fix For: API 2.16.2
>
>         Attachments: sling-api-patch.txt
>
>
> If I mount a file system path to e.g. '/libs/sling/resource-editor' jsp changes are not picked up by the jsp compiler. 
> FileMonitor.sendEvents(... ObservationReporter) gets an ObservationReporter as a parameter that doesn't return ObserverConfigurations in getObserverConfigurations() thus no changes are reported to the jsp compiler. 
> The reason is, that they are not added in it's constructor (BasicObservationReporter:99) because 'providerPath.matches(p.getPath())' returns false. If I manually change that in the debugger to true the mount works well. In this example the providerPath is '/libs/sling/resource-editor' and p.getPath() is 'glob:/libs/**/*.jsp'. (See patch for PathTest.java) 
> org.apache.sling.api.resource.path.Path.matches() in line 128 and following counts three slashes for '/libs/sling/resource-editor' and uses the substring of the glob expression until a fourth (3+1) slash or the end of the string. This leads to a glob expression of 'glob:/libs/**/*.jsp' instead of 'glob:/libs/**' and returns false. 
> I don't have an overview of all use cases but judging from the PathTest the amount of slashes counted should not exceed the amount of slashes in the glob expression minus one if the glob expression uses an extension. I will add a patch for org.apache.sling.api.resource.path.Path as well so you can choose not to apply it if it's not correct.



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