Project

Profile

Help

Bug #3260

closed

Sequence size incorrecly reported as 50

Added by Gunther Rademacher almost 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Internals
Sprint/Milestone:
-
Start date:
2017-06-11
Due date:
% Done:

100%

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

Description

Congratulations on completing XSLT 3.0, and thanks for releasing Saxon 9.8!

With Saxon-HE 9.8.0.1, I have observed the size of a sequence being maintained incorrectly. The attached program issues some tracing in line 418. It shows that count($stack) at one point is shown as 50, though the last item in $stack is at index 36.

Not sure whether there is any relation, but this reminded me of an old issue that I had reported some 4 years ago: http://markmail.org/message/qzixjoaxmp2xq34y


Files

parse.xq (21.8 KB) parse.xq Gunther Rademacher, 2017-06-11 17:14
Actions #1

Updated by Michael Kay almost 7 years ago

  • Category set to Internals
  • Status changed from New to Resolved
  • Assignee set to Michael Kay
  • Fix Committed on Branch 9.8, trunk added

It's certainly in the same area as the previous bug, though not quite the same bug.

The MemoClosure / MemoSequence allocates a reservoir (buffer) of initial size 50 which is incrementally filled with items as required. If items are accessed by subscript, it reads input items up to the required subscript. When count is called, it reads all remaining items from the input and returns the total number of items in the reservoir. The code is incorrectly assuming that when all items have been read, the "reservoir" array will be the correct length. But in fact it is only condensed (from the initial size of 50) if the space saving looks worthwhile. If 30 items have been used, it decides that copying the array isn't worthwhile, but then incorrectly returns the length of the sequence as 50 rather than 30.

Patch committed to MemoSequence.ProgressiveIterator.materialize().

Actions #2

Updated by Michael Kay almost 7 years ago

QT3 test case app-Demos/RexParser created

Actions #3

Updated by Gunther Rademacher almost 7 years ago

Where would I find the patch? I was looking for https://dev.saxonica.com/repos/archive/opensource/latest9.8 , but that does not seem to exist.

Actions #4

Updated by Michael Kay almost 7 years ago

We haven't yet established a 9.8 branch in the public repository, it should be there within a few days.

Actions #5

Updated by Gunther Rademacher almost 7 years ago

Thank you for the quick fix. With the patch this works fine now.

Actions #6

Updated by O'Neil Delpratt almost 7 years ago

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

Patch applied in the Saxon 9.8.0.2 maintenance release

Please register to edit this issue

Also available in: Atom PDF