Project

Profile

Help

Bug #4974

closed

XQuery Update: namespace propagation is not working

Added by Michael Kay almost 3 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XQuery Update
Sprint/Milestone:
-
Start date:
2021-04-20
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
10, 9.9, trunk
Fix Committed on Branch:
10, trunk
Fixed in Maintenance Release:
Platforms:

Description

XQuery Update test case id-insert-expr-086 is failing on the 11.x branch, and I suspect it probably fails on 10.x as well.

When we add a namespaced attribute p:att to an element E, we are adding a namespace binding for prefix p to element E, but we are not propagating it to descendants of E. In the past, we didn't need to do anything to achieve this propagation, but with namespaces now being held with each element as a NamespaceMap, it needs to be done explicitly.


Related issues

Has duplicate Saxon - Support #5173: Certain XQuery update operations seem to be failing with Saxon 10Closed2021-11-24

Actions
Actions #1

Updated by Michael Kay almost 3 years ago

Also affects test id-rename-expr-033/034

Also id-replace-expr-045

Also mergeUpdates-001

Actions #2

Updated by Michael Kay almost 3 years ago

I've now run these tests against 10.3 using the 10.x UpdateTestSuiteDriver, and surprisingly the tests appear to succeed.

More careful examination shows that this is a false positive. The comparison of actual results with expected results is actually failing with an IndexOutOfBoundsException, which is being ignored, so the test is reported as a pass when it should have reported a failure.

Actions #3

Updated by Michael Kay almost 3 years ago

With this bug in UpdateTestSuiteDriver fixed, the following tests now fail on 10.3:

  id-insert-expr-086
  id-replace-expr-045
  id-rename-expr-033
  id-rename-expr-034

(But not merge-updates-001, so that might be a different problem).

Actions #4

Updated by Michael Kay almost 3 years ago

When child elements are inserted, the InsertExpression and InsertAction object contain a flag to indicate whether namespace inheritance is in force (in the query static context), and it looks like the logic has been changed for the 10.0 namespace model to reflect this: the instruction ends up calling (or not calling) ((ElementImpl) child).fixupInsertedNamespaces(inherit); to handle the namespace inheritance.

By contrast, InsertAttributeAction has no flag for namespace inheritance. I suspect that under the old namespace model, namespace inheritance was always happening implicitly, and it is now never happening in the case of attribute insertion.

But RenameAction also has no flag for this.

Actions #5

Updated by Michael Kay almost 3 years ago

So, I've been trying to find out how this ever worked, and I've discovered it never did. Looking back at 9.9, the RenameAction makes no attempt to distinguish between the inherit/no-inherit cases. It always (in effect) does "inherit", and the reason the no-inherit tests appear to work is because of the same bug in the UpdateTestSuiteDriver: the compare() method returns "true" when comparing an empty string with a non-empty string.

Actions #6

Updated by Michael Kay almost 3 years ago

  • Status changed from New to Resolved
  • Applies to branch 10, 9.9, trunk added
  • Fix Committed on Branch trunk added

I've fixed this in the development (11.x) branch.

I've decided not to fix it for 10.x or earlier releases. The problem has been present for years without anyone noticing, and the fix involves changes to the MutableNodeInfo interface which people might be using, so on balance it's probably better to leave 10.x alone.

Actions #7

Updated by O'Neil Delpratt over 2 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 10.6 added

Bug fix applied in the Saxon 10.6 maintenance release

Update: no, see comments above, the problem was not fixed in 10.6.

Actions #8

Updated by Michael Kay over 2 years ago

  • Status changed from Closed to In Progress

This has now been raised as an external bug on the 10.x branch (see bug #5173) so I am re-opening this as it seems reasonable to fix it on the 10.x branch if possible.

Actions #9

Updated by Michael Kay over 2 years ago

  • Has duplicate Support #5173: Certain XQuery update operations seem to be failing with Saxon 10 added
Actions #10

Updated by Michael Kay about 2 years ago

  • Status changed from In Progress to Resolved
  • Fix Committed on Branch 10, 11 added

The fix has now been retrofitted to the Saxon 10.x branch.

Note that this involves changes to some methods in the MutableNodeInfo interface, so it could be disruptive.

Actions #11

Updated by Debbie Lockett about 2 years ago

  • Fix Committed on Branch deleted (11)
  • Fixed in Maintenance Release deleted (10.6)

Removing "Fix Committed in Branch 11" label because this was never actually a bug for any 11 release, it was fixed on the trunk before 11.0 was released.

Also removing mistaken "Fixed in Maintenance Release 10.6" label.

Actions #12

Updated by Debbie Lockett about 2 years ago

  • Status changed from Resolved to Closed
  • Fixed in Maintenance Release 10.7 added

Bug fix applied in the Saxon 10.7 maintenance release.

Please register to edit this issue

Also available in: Atom PDF