"error: Success" from fsm_trim
katef opened this issue · 6 comments
; cat /tmp/ha-target.fsm
0; 1; 2; 3; 4; 5;
0 -> 1;
0 -> 1 "e";
1 -> 2 "b";
2 -> 3 "g";
2 -> 4 "h";
3 -> 0 "h";
4 -> 0;
4 -> 1 "h";
5 -> 1 "a";
5 -> 3 "h";
start: 5;
end: 3;
gives:
; fsm -t trim -capl dot < /tmp/ha-target.fsm
fsm_op: Success
and:
; cat /tmp/ha-target.fsm
0; 1; 2; 3; 4;
0 -> 2 "a"; # e.g. "a"
0 -> 1 "b"; # e.g. "ac"
0 -> 0 "c"; # e.g. "ac"
1 -> 0 "c"; # e.g. "ac"
1 -> 2 "c"; # e.g. "a"
2 -> 0 "c"; # e.g. "ac"
2 -> 1 "c"; # e.g. "ac"
3 -> 2 "a"; # e.g. "a"
4 -> 3 "a"; # start
4 -> 2 "c"; # e.g. "a"
start: 3;
end: 1;
; fsm -t trim < /tmp/ha-target.fsm
zsh: segmentation fault fsm -t trim < /tmp/ha-target.fsm
smaller:
; cat /tmp/ha-target.fsm
0; 1; 2; 3; 4;
0 -> 1 "g";
1 -> 2 "b";
2 -> 1;
3 -> 3 "h";
4 -> 0 "b";
start: 4;
end: 0;
; cat /tmp/ha-target.fsm | fsm -t trim
zsh: done cat /tmp/ha-target.fsm |
zsh: segmentation fault fsm -t trim
;
Is this about the return type from fsm_trim
? I have an instance or two of that in test code fixed on my branch for captures, but if I found any in the main code I thought I'd posted a PR to fix them already. I can look into this next week.
At whatever point the entire codebase switches to C99, checking whether return types need to be int
rather than bool
may find issues.
I'm not sure about the "error: Success", but the segfault is around line 324:
base = (s_id == 0 ? 0 : offsets[s_id - 1]);
where for the most recent test case there:
offset_count = 3
s_id = 4
I'm pretty sure I have that specific issue fixed on my branch, I'll cherry-pick it out and post a PR in the next couple days. I thought I had introduced it as part of work on that branch, but apparently not.