Fix // followed by reverse axis step being misinterpreted#6080
Closed
joewiz wants to merge 1 commit intoeXist-db:developfrom
Closed
Fix // followed by reverse axis step being misinterpreted#6080joewiz wants to merge 1 commit intoeXist-db:developfrom
joewiz wants to merge 1 commit intoeXist-db:developfrom
Conversation
dcf61fc to
c280cec
Compare
duncdrum
approved these changes
Mar 3, 2026
The // abbreviation in XPath expands to /descendant-or-self::node()/. When followed by a reverse axis (preceding, ancestor, etc.), the tree walker incorrectly overwrote the reverse axis with DESCENDANT_SELF_AXIS, destroying the original semantics. For example, $node//preceding::node() behaved like $node/descendant-or-self::node() instead of the correct $node/descendant-or-self::node()/preceding::node(). Fix both the DSLASH and ABSOLUTE_DSLASH handlers to detect reverse axes (constants 0-4) and insert an explicit descendant-or-self::node() step before the reverse axis step, rather than merging them. Closes eXist-db#691 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
c280cec to
24565eb
Compare
3 tasks
Open
3 tasks
Member
Author
|
[This comment was co-authored with Claude Code. -Joe] Closing — superseded by #6207 (v2/xq31-compliance-fixes). This work has been consolidated into a clean v2/ branch as part of the eXist-db 7.0 PR reorganization. The new PR includes all commits from this PR plus additional related work, with reviewer feedback incorporated where applicable. See the reviewer guide for the full context. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
//(DSLASH) followed by a reverse axis step (preceding::,ancestor::,ancestor-or-self::,parent::,preceding-sibling::) being misinterpreted by the XQuery tree walkerDESCENDANT_SELF_AXIS, so e.g.$node//preceding::node()behaved like$node/descendant-or-self::node()instead of the correct$node/descendant-or-self::node()/preceding::node()DSLASHandABSOLUTE_DSLASHhandlers to detect reverse axes and insert an explicitdescendant-or-self::node()step before the reverse axis step, rather than merging them//with all reverse axesCloses #691
Test plan
dslashWithReverseAxistest inXPathQueryTestpasses (both local and remote parametrized variants)XPathQueryTesttests pass with no regressionsprod-AxisStep.*test suites (345 tests) show zero regressions compared to baseline🤖 Generated with Claude Code