Re: Compile+execution problems on: SWI-Prolog 6.6.3

Jan Wielemaker <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
On 03/18/2014 10:20 PM, jon wrote:
> Hi,
>
> I have 2 problems.. first on the compilation, then on running it once
> compiled. This is on Ubuntu 12.04 LTS.
>
> *1. Compile - incorrect syntax*

> The offending predicate is:
>
> map_bits(_, Var, _, _) :-
>	*var(Var), !,*
>
> Should be a full stop at the end ?

No.  It should have a line '$instantiation_error'(Var).  Somehow the git
cherry-pick messed up here.  Fixed.  Not really dramatic.

> If I manually fix the full step, it compiles correctly.  Then I try to run
> it:
>
> *2.  Stack overflow on exit.*
> Fire it up, then immediately do a Ctrl+C/E to exit (before doing
> anything..).
> The first Ctrl+C/E just puts it into a zombie state, so do the same again,
> and it bombs out:
>
> $ prolog
> Welcome to SWI-Prolog (Multi-threaded, 32 bits, Version 6.6.3)
> Copyright (c) 1990-2013 University of Amsterdam, VU Amsterdam
> SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
> and you are welcome to redistribute it under certain conditions.
> Please visit http://www.swi-prolog.org for details.
>
> For help, use ?- help(Topic). or ?- apropos(Word).
>
> ?-
> [forced] Action (h for help) ? exit
>
> [forced] Action (h for help) ? exit

Same happens here with pretty old versions.  The problem is that
GNU readline doesn't allow for graceful handling of Control-C at
this level (well, maybe it does, but it surely doesn't work as
libreadline is used by default).

^C first tries the safe route: it sets a flag and hopes for Prolog to
see it at a safe point. That doesn't happen as long as it is blocked in
GNU readline(). Another ^C shows [forced], which means it will try
non-graceful handling of the interrupt. This is fundamentally unsafe, as
it breaks out of whatever it is doing using a C longjmp(), not allowing
code to cleanup, notably leaving locks it may hold in the locked state.

Possibly we should give a much more severe feedback than merely
[forced]?

> I have been reliably using 6.2.6 day in, day out, so there's nothing in
> principle completely broken in my configuration.

Possibly this version was not linked to readline a all?  Without readline
^C works just fine.

> After getting the above error,  if I make clean in 6.6.3, and revert back to
> 6.2.6 (again, compiling from source), I am able to exit prolog correctly.

Does this include readline?  I.e., can you edit commands using the arrow
keys?

	Cheers --- Jan

> If you need any further logs, compilations on different versions / dev
> versions etc, please shout, and I'll do it.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.