Opened 11 years ago
Closed 11 years ago
#1135 closed defect (fixed)
string-copy! bug
Reported by: | Mario Domenech Goulart | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 4.10.0 |
Component: | core libraries | Version: | 4.9.x |
Keywords: | string-copy!, srfi-13 | Cc: | |
Estimated difficulty: |
Description
While using the gap-buffer egg (implementation ported from Guile), I noticed a weird behavior in certain cases (see http://lists.gnu.org/archive/html/guile-devel/2014-06/msg00060.html)
Looks like the culprit is string-copy!
(probably C_substring_copy
), as it was in Guile's case (as pointed by Mark H Weaver).
A test case from Guile's test suite illustrates the problem:
(let ((str (string-copy "abcde"))) (string-copy! str 1 str 0 3) str) => "aaaae" Expected: "aabce"
Attachments (2)
Change History (5)
Changed 11 years ago by
Attachment: | 0001-C_substring_copy-use-C_memmove-instead-of-C_memcpy-w.patch added |
---|
comment:1 Changed 11 years ago by
Changed 11 years ago by
Attachment: | 0001-C_substring_copy-use-C_memmove-instead-of-C_memcpy.patch added |
---|
comment:2 Changed 11 years ago by
Seth Alves pointed out on #chicken that checking for string equality is pointless, since memmove will do that anyway. So, attached is a new patch which just replaces C_memcpy by C_memmove in C_substring_copy.
comment:3 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed by 6b36695d94e0bd977e0d85d48438f621128e1101
The attached patch Works For Me, although I don't know if it is the optimal/correct solution.