SWI-Prolog / issues

Dummy repository for issue tracking
7 stars 3 forks source link

JPL toString regression bug #76

Open Wouter1 opened 6 years ago

Wouter1 commented 6 years ago

Previously, atoms like 'a\'b' printed correctly (as 'a\'b')

But jpl 7.6.4 gives 'a'b' ,so without properly escaping special characters inside the atom

Junit test showing the failure:

        Atom atom = new Atom("a'b");
        assertEquals("'a\\'b'", atom.toString());
Wouter1 commented 5 years ago

@JanWielemaker

Do I get the fixed version if I download the develop version of SWI from here ?

http://www.swi-prolog.org/download/devel

And when will it be in the stable release?

JanWielemaker commented 5 years ago

Do I get the fixed version if I download the develop version of SWI from here ?

Only if you download from the daily page and don't take the one from tomorrow as I reverted this patch due to https://github.com/SWI-Prolog/packages-jpl/issues/14. Some discussion is going on in various issues raised at the packages-jpl repo.

Next stable release will be 7.8. When is pretty unclear. I'm aiming before the next Debian release freeze in January. Lots of things are in flux though and only time will tell us when this stabilizes.

Wouter1 commented 5 years ago

@JanWielemaker Thanks. This "new" issue is weird. The replacement code was just the same as thee old code that apparently always worked correct?

JanWielemaker commented 5 years ago

I don't follow all the details. Trying to get the unit tests to work using the new cmake config however raised an exception which caused a Java stack overflow. After reverting this patch I got a nice exception about a missing file.

A stack overflow is unacceptable. Otherwise I leave this to those interested in JPL and knowledgeable about Java.

ssardina commented 5 years ago

Ohh, OK I finally found this issue here in this repo rather than on the JPL repo.

There seems to be a lot of background on this already, I wish I knew it was here... :-)

Anyway, yes the replacement is just a revert, at least for the moment. That's why I recognized that: "but I am guessing I am missing something on why it was done so sophisticated via calls to Prolog to convert a name into a potentially quoted name." This issue here explains it.

BTW, there is a bit of a difference between the revert and my (temporary) code in my fork, in Compound. The reverted code cannot handle, I think, complex functor names (SWI does), like A= '[1,2,3](a,b,c). I think.

Will have to study all this issue carefully but indeed my problem was that stack overflow was not OK when I use this for my course, I needed the clear Prolog exception printed out nicely.. :-)

Wouter1 commented 5 years ago

@JanWielemaker Just a guess. Is it possible that JPL tries to quote error messages as well? If then there is some bug/typo in that quotedName code we would get into a loop. It could even be that SWI tries to report some issue, but that JPL then tries to make a nice string from it and calls SWI again, after which SWI again reports the issue, etc.

Maybe error handling in JPL should avoid calling SWI again.

Wouter1 commented 5 years ago

Just to let you know, the project leader moved to another university. So I won't be working on this anymore.