Uploaded image for project: 'Jackrabbit FileVault'
  1. Jackrabbit FileVault
  2. JCRVLT-549

node cannot be deleted if it's a residual mandatory child node

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.4.0
    • 3.5.6
    • vlt
    • None

    Description

      Let say we have a rule in nodetype.cnd file

      [a:RolloutConfig] > mix:title
       orderable
       - a:trigger (string) mandatory
       + * (a:LiveSyncAction) mandatory
      
      [a:LiveSyncAction] > nt:unstructured
      

      When a package(first) is installed where parent node's(rolloutconfigs) .content.xml has:

      <?xml version="1.0" encoding="UTF-8"?>
      <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rep="internal"
          jcr:mixinTypes="[rep:AccessControllable]"
          jcr:primaryType="sling:OrderedFolder"
          jcr:title="Rollout Configurations">
          <default/>
          <pushonmodify/>
          <activate/>
          <deactivate/>
      </jcr:root>
       

       and default node's has .content.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <jcr:root xmlns:a="http://www.day.com/jcr/a/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
          a:trigger="rollout"
          jcr:description="abc"
          jcr:primaryType="a:RolloutConfig"
          jcr:title="Standard rollout config">
          <contentUpdate jcr:primaryType="a:LiveSyncAction"/>
          <contentCopy jcr:primaryType="a:LiveSyncAction"/>
          <contentDelete jcr:primaryType="a:LiveSyncAction"/>
          <referencesUpdate jcr:primaryType="a:LiveSyncAction"/>
          <personalizationContentRollout jcr:primaryType="a:LiveSyncAction"/>
      </jcr:root>
      

      Installing another package(second) with the same cnd file but with different child node's(default node) content.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <jcr:root xmlns:a class="code-quote">"http://www.day.com/jcr/a/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
          a:trigger="rollout"
          jcr:description="abc"
          jcr:primaryType="a:RolloutConfig"
          jcr:title="Standard rollout config">
          <activate jcr:primaryType="a:LiveSyncAction"/>
          <contentCopy jcr:primaryType="a:LiveSyncAction"/>
      </jcr:root>
      

      marks the below node for Deletion but doesn't delete them because it's a mandatory node

      D /x/y/z/rolloutconfigs/default/contentDelete
      D /x/y/z/rolloutconfigs/default/contentUpdate
      D /x/y/z/rolloutconfigs/default/orderChildren
      D /x/y/z/rolloutconfigs/default/personalizationContentRollout
      D /x/y/z/rolloutconfigs/default/referencesUpdate
      

      The issue lies at https://github.com/apache/jackrabbit-filevault/blob/jackrabbit-filevault-3.2.8/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/DocViewSAXImporter.java#L1190 . Here, check for the child node is mandatory or not is done after marking it for delete importInfo.onDeleted(path) which gives wrong information that the child node is deleted but in the repository, it still exists.

      Attachments

        Issue Links

          Activity

            ankitaagar Sorry but this error report lacks details. I don't have an idea what is meant with the summary. Please add description and steps to reproduce.

            kwin Konrad Windszus added a comment - ankitaagar Sorry but this error report lacks details. I don't have an idea what is meant with the summary. Please add description and steps to reproduce.
            ankitaagar Ankita Agarwal added a comment - - edited

            kwin Sure, I will also provide a patch

             

            ankitaagar Ankita Agarwal added a comment - - edited kwin Sure, I will also provide a patch  
            ankitaagar Ankita Agarwal added a comment -

            kwin I am working on it will provide the patch

            ankitaagar Ankita Agarwal added a comment - kwin  I am working on it will provide the patch

            the problem is, that cq:LiveSyncAction are mandatory child nodes, but with the * names, i.e. you can actually delete them when at least 1 remains.

            but the check in the import just rejects mandatory child nodes in general. it would probably be better to check if it has a fix mandatory name.

            tripod Tobias Bocanegra added a comment - the problem is, that cq:LiveSyncAction are mandatory child nodes, but with the * names, i.e. you can actually delete them when at least 1 remains. but the check in the import just rejects mandatory child nodes in general. it would probably be better to check if it has a fix mandatory name.

            ankitaagar I will do a release of FileVault soon. Can you come up with a patch or at least a failing test case?

            kwin Konrad Windszus added a comment - ankitaagar I will do a release of FileVault soon. Can you come up with a patch or at least a failing test case?
            ankitaagar Ankita Agarwal added a comment -

            kwin I will provide the patch within this week.

            ankitaagar Ankita Agarwal added a comment - kwin I will provide the patch within this week.
            ankitaagar Ankita Agarwal added a comment -

            kwin/ tripod Raised a PR https://github.com/apache/jackrabbit-filevault/pull/163
            Request you to review the PR.

            ankitaagar Ankita Agarwal added a comment - kwin / tripod Raised a PR https://github.com/apache/jackrabbit-filevault/pull/163 Request you to review the PR.
            ankitaagar Ankita Agarwal added a comment - kwin and tripod Could you please review the PR -> https://github.com/apache/jackrabbit-oak/pull/382 , raised as per comments on https://github.com/apache/jackrabbit-filevault/pull/163

            Please find a solution which works with older Oak versions.

            kwin Konrad Windszus added a comment - Please find a solution which works with older Oak versions.

            Actually JCR 2.0 mandates that mandatory residual definitions are not supported (https://www.adobe.io/experience-manager/reference-materials/spec/jcr/2.0/3_Repository_Model.html#3.7.2.4%20Mandatory) and therefore these constraint are subsequently not enforced. That means that for a nodetype

            [a:RolloutConfig] > mix:title
             orderable
             - a:trigger (string) mandatory
             + * (a:LiveSyncAction) mandatory
            

            all LiveSyncAction child nodes can be safely removed (although being mandatory).

            kwin Konrad Windszus added a comment - Actually JCR 2.0 mandates that mandatory residual definitions are not supported ( https://www.adobe.io/experience-manager/reference-materials/spec/jcr/2.0/3_Repository_Model.html#3.7.2.4%20Mandatory ) and therefore these constraint are subsequently not enforced. That means that for a nodetype [a:RolloutConfig] > mix:title orderable - a:trigger (string) mandatory + * (a:LiveSyncAction) mandatory all LiveSyncAction child nodes can be safely removed (although being mandatory).
            reschke Julian Reschke added a comment -

            Hmmm. Good find.

            One could argue that it's a bug in Oak that it supports these, and that should be fixed. That may be hard now that it apparently is used in practice. Would be good to find out what exactly Oak is enforcing here (to see whether that support is actually meaningful and could be considered an "extension" of JCR).

            For this ticket, I would suggest to put it aside (and not wait for its resolution for the next filevault release), until we have made our homework on the Oak side of things.

            reschke Julian Reschke added a comment - Hmmm. Good find. One could argue that it's a bug in Oak that it supports these, and that should be fixed. That may be hard now that it apparently is used in practice. Would be good to find out what exactly Oak is enforcing here (to see whether that support is actually meaningful and could be considered an "extension" of JCR). For this ticket, I would suggest to put it aside (and not wait for its resolution for the next filevault release), until we have made our homework on the Oak side of things.
            kwin Konrad Windszus added a comment - Fixed in https://github.com/apache/jackrabbit-filevault/commit/3eb928da8cbe21b42a2b5ed9bda8d72e1722856a .

            People

              kwin Konrad Windszus
              ankitaagar Ankita Agarwal
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: