Type | Bug | Status | pending | Date | 13-May-2014 17:58 |
---|---|---|---|---|---|
Version | r3 master | Category | Unspecified | Submitted by | kealist |
Platform | All | Severity | minor | Priority | normal |
Summary | TRACE ON shows bizzare parse behavior |
---|---|
Description | I noticed some string corruption in the printing of TRACE. I don't know how deep that it extends or if it's just confined to trace output, but it's worth investigating |
Example code |
trace on open http://www.google.com =============== Will result in: =============== 9: rules : [ [ copy s1 some scheme-char ":" opt --> parse Parse match: make bitset! #{000000000016FFC07FFFFFE07FFFFFE0} Parse input: http://www.google.com Parse match: make bitset! #{000000000016FFC07FFFFFE07FFFFFE0} Parse input: ttp://www.google.comm Parse match: make bitset! #{000000000016FFC07FFFFFE07FFFFFE0} Parse input: tp://www.google.commm Parse match: make bitset! #{000000000016FFC07FFFFFE07FFFFFE0} Parse input: p://www.google.commmm Parse match: make bitset! #{000000000016FFC07FFFFFE07FFFFFE0} Parse input: ://www.google.commmmm Parse match: ":" Parse input: ://www.google.commmmm Parse match: "//" Parse input: //www.google.commmmmm 1: reduce/into 2: [to set-word! 'scheme to lit-word! to string! s1] 3: tail : action! [series] 4: out : [] --> tail <-- tail == [] --> reduce 1: to : action! [type spec] 2: set-word! : set-word! 3: 'scheme --> to <-- to == scheme: 4: to : action! [type spec] 5: lit-word! : lit-word! 6: to : action! [type spec] 7: string! : string! 8: s1 : http --> to <-- to == "http" --> to <-- to == 'http <-- reduce == [] Parse match: make bitset! #{000000001F3EFFD47FFFFFE17FFFFFE8} Parse input: www.google.comommmmmm Parse match: make bitset! #{000000001F3EFFD47FFFFFE17FFFFFE8} Parse input: ww.google.commommmmmm Parse match: make bitset! #{000000001F3EFFD47FFFFFE17FFFFFE8} Parse input: w.google.commmommmmmm Parse match: make bitset! #{000000001F3EFFD47FFFFFE17FFFFFE8} Parse input: .google.commmmommmmmm Parse match: make bitset! #{000000001F3EFFD47FFFFFE17FFFFFE8} Parse input: google.commmmmommmmmm Parse match: make bitset! #{000000001F3EFFD47FFFFFE17FFFFFE8} Parse input: oogle.commmmmmommmmmm Parse match: make bitset! #{000000001F3EFFD47FFFFFE17FFFFFE8} Parse input: ogle.commmmmmmommmmmm Parse match: make bitset! #{000000001F3EFFD47FFFFFE17FFFFFE8} |
Assigned to | n/a | Fixed in | - | Last Update | 26-Jan-2015 07:38 |
---|
Comments | |
---|---|
(0004428)
fork 13-May-2014 18:37 |
Possibly linked to the bitset. Easier repro:
>> letter: charset [#"a" - #"z"] == make bitset! #{0000000000000000000000007FFFFFE0} >> trace on <-- trace == unset! >> parse "abcdefg" [some letter] 1: parse : native! [input rules /all /case] 2: "abcdefg" 3: [some letter] --> parse Parse match: make bitset! #{0000000000000000000000007FFFFFE0} Parse input: abcdefg Parse match: make bitset! #{0000000000000000000000007FFFFFE0} Parse input: bcdefgg Parse match: make bitset! #{0000000000000000000000007FFFFFE0} Parse input: cdefggg Parse match: make bitset! #{0000000000000000000000007FFFFFE0} Parse input: defgggg Parse match: make bitset! #{0000000000000000000000007FFFFFE0} Parse input: efggggg Parse match: make bitset! #{0000000000000000000000007FFFFFE0} Parse input: fgggggg Parse match: make bitset! #{0000000000000000000000007FFFFFE0} Parse input: ggggggg Parse match: make bitset! #{0000000000000000000000007FFFFFE0} Parse input: ggggggg <-- parse == true == true Casual search I guess that message is coming from this line: https://github.com/rebol/rebol/blob/25033f897b2bd466068d7663563cd3ff64740b94/src/core/u-parse.c#L191 Trace_String is defined here: https://github.com/rebol/rebol/blob/25033f897b2bd466068d7663563cd3ff64740b94/src/core/c-do.c#L285 And that specific trace string input string is, I think, 8? Somewhat tenuous "magic number" relationship there with the strings. :-/ https://github.com/rebol/rebol/blob/25033f897b2bd466068d7663563cd3ff64740b94/src/boot/strings.r#L83 Note a few lines away there is a warning that says "!!! THIS CODE NEEDS CLEANUP AND REWRITE BASED ON OTHER CHANGES", and an unused variable "int rewrite_needed" which is apparently there to trigger an unused variable build warning. Valgrind didn't complain to me. Given that it still works, perhaps the trace output is expecting some null termination in a buffer to be maintained that isn't when matches are done against bitsets. (shrug) Insert my usual formalisms speech here... :-/ |
(0004429)
szeng 13-May-2014 19:48 |
I think it's fixed here:
https://github.com/zsx/r3/commit/25d35a946269c6547b1f1091b10753ccc4b91216 The problem is that Trace_String didn't copy the terminating '\0' to the string to be printed. |
(0004431)
abolka 13-May-2014 22:34 |
Shixin's fix upstreamed as PR:
https://github.com/rebol/rebol/pull/221 |
Date | User | Field | Action | Change |
---|---|---|---|---|
26-Jan-2015 07:38 | abolka | Code | Modified | - |
26-Jan-2015 07:38 | abolka | Status | Modified | submitted => pending |
13-May-2014 22:34 | abolka | Comment : 0004431 | Added | - |
13-May-2014 19:48 | szeng | Comment : 0004429 | Added | - |
13-May-2014 18:39 | fork | Comment : 0004428 | Modified | - |
13-May-2014 18:37 | fork | Comment : 0004428 | Added | - |
13-May-2014 17:58 | kealist | Ticket | Added | - |