Opened 3 weeks ago

Last modified 6 days ago

#1835 reopened defect

Error in the utf8 egg's substring=?

Reported by: siiky Owned by: siiky
Priority: major Milestone: someday
Component: extensions Version: 5.4.0
Keywords: utf8 Cc:
Estimated difficulty:

Description

First found it using tab-completion in csi:

Error: (substring=?) out of range
3
0
3

	Call history:

	utf8-srfi-13.scm:374: proc
	utf8-srfi-13.scm:374: proc
	utf8-srfi-13.scm:374: proc
	utf8-srfi-13.scm:374: proc
	utf8-srfi-13.scm:374: proc
	utf8-srfi-13.scm:374: proc
	utf8-srfi-13.scm:374: proc
	utf8-srfi-13.scm:374: proc
	utf8-srfi-13.scm:374: proc
	utf8-srfi-13.scm:374: proc
	utf8-srfi-13.scm:374: proc
	utf8-srfi-13.scm:374: proc
	utf8-srfi-13.scm:374: proc
	utf8-srfi-13.scm:374: proc
	utf8-srfi-13.scm:374: proc
	utf8-srfi-13.scm:374: proc	  	<--

This is seen in the egg's tests as well: http://salmonella-linux-x86.call-cc.org/master/clang/linux/x86/2024/04/11/salmonella-report/test/utf8.html (chicken-install's exit code is 0, I'm not seeing why -- there's a test-begin at the top and a test-end at the bottom -- though this is another problem):

(string-prefix? "元麻布" "麻布十番" 1) ........................ [ERROR]

Error: (substring=?) out of range
6
0
6
(string-prefix? "元麻布" "麻" 1 2) ............................... [ERROR]

Error: (substring=?) out of range
3
0
3

It's almost certain these errors are related to the recent changes made to substring=? and friends: https://code.call-cc.org/cgi-bin/gitweb.cgi?p=chicken-core.git;a=commit;h=0e97b648407d750f1e476e3c193e136126558346

Change History (2)

comment:1 Changed 2 weeks ago by felix winkelmann

Resolution: fixed
Status: assignedclosed

comment:2 Changed 6 days ago by siiky

Resolution: fixed
Status: closedreopened

(substring=? "" "" 0 0 0) results in a range error too. Sorry I forgot to update this ticket the other day.

I believe the problem is in the lines (##sys#check-range start1 0 (##sys#size s1) 'substring=?), when the string is empty -- it amounts to (##sys#check-range 0 0 0 'substring=?).

I can't tell what the obvious fix is, if there is one. Return #t if one of the strings is empty?

Last edited 6 days ago by siiky (previous) (diff)
Note: See TracTickets for help on using tickets.