Hi Steve, hi Gerwin,
using the skeleton.nested, the resulting program showed the following behaviour:
echo "list sessions;" | sdmsh
hangs forever. But
echo "list sessions;" > /tmp/x
sdmsh < /tmp/x
teminates as should be.
After merging the skeleton.default and skeleton.nested this erroneous behaviour vanished.
Diffing the old and new skeleton.nested shows (< == new; > == old):
[ronald@cheetah shell]$ diff skeleton.nested* | more
39c39
<
---
>
169c169
< while (numRead == 0) { // bug #130 discussion; while is better than if
---
> if (numRead == 0) {
403,409d402
< // cached fields:
< int zzCurrentPosL;
< int zzMarkedPosL;
< int zzEndReadL = zzEndRead;
< char [] zzBufferL = zzBuffer;
< char [] zzCMapL = ZZ_CMAP;
<
413c406,411
< zzMarkedPosL = zzMarkedPos;
---
> // cached fields:
> int zzCurrentPosL;
> int zzMarkedPosL = zzMarkedPos;
> int zzEndReadL = zzEndRead;
> char [] zzBufferL = zzBuffer;
> char [] zzCMapL = ZZ_CMAP;
The HUGE difference is that the variables (notably zzEndReadL) aren't initialized by skeleton.default in every iteration of the while loop.
During the merge I wondered why there are two skeletons in the first place. Those who don't want to read from multiple streams just don't call yypushStream() and friends. One skeleton would be more than enough (and a link for backward compatibility).
for the sake of completeness I attached the new skeleton.nested.
Regards,
Ronald
small add-on.
Today I tried to write a minimal "working" example. So far I didn't succeed, unfortunately. It was even so, that our software seemed to work as intended, regardless of the skeleton used.
After a complete recompile, the software failed again, blocking as described.
Odd enought, it now also blocks when using a file as input. (Actually I think the original behaviour is stranger than the actual behaviour. The use of "odd" refers to the fact that a system behaves differently after a recompile of unchanged sources).
There's no difference in behaviour between the two skeletons any more (the original and the patched version).
It's all very weird. I'll do some more investigations. If I get any results, I'll report them. In the mean time I accept this to be a low priority bug, as everything works flawlessly with jflex 1.4.x
For the record, the relevant part of jstack output:
My next attempt to build a minimal working example has been a bit more successful. Attached are:
after a
resp.
the following test shows the difference:
The 1.7 version hangs, the 1.4 version doesn't.
Obviously the title of the bug is wrong. Sorry for that.
I'll continue to investigate the matter, but would gratefully accept any help.
Although this source code works flawlessly since years, I don't exclude the possibility of a small flaw in my jflex code. The fact that the 1.4 version requires two "^D" to terminate might be a clue here.
The java version I'm using is