gprolog toplevel fails on basic example (fixed upstream?)

Bug #1711346 reported by Cedric Ware
36
This bug affects 6 people
Affects Status Importance Assigned to Milestone
gprolog (Debian)
Fix Released
Unknown
gprolog (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Hello,

In Ubuntu 17.04 (Zesty), with gprolog 1.4.5-4.1, the toplevel interpreter fails to execute valid code, including this basic example copied from the manual:

krakatoa ~ % gprolog
GNU Prolog 1.4.5 (64 bits)
Compiled Feb 5 2017, 10:30:08 with gcc
By Daniel Diaz
Copyright (C) 1999-2016 Daniel Diaz
| ?- [user].
compiling user for byte code...
even(0).
even(s(s(X))) :- even(X).

user compiled, 2 lines read - 326 bytes written, 12353 ms

(3 ms) yes
| ?- even(X).

X = 0 ? ;
uncaught exception: error(existence_error(procedure,even/0),even/0)
| ?-

The same example works with all other versions of gprolog I tested: the older 1.3.0-6.1 in Xenial; the stable version 1.4.4 downloaded from http://www.gprolog.org/ (with commit cc8249 applied manually to fix compilation); as well as a freshly-cloned git repository from https://git.code.sf.net/p/gprolog/code . For instance:

krakatoa ~ % export PATH=/opt/gprolog-1.4.4/bin:$PATH
krakatoa ~ % gprolog
GNU Prolog 1.4.4 (64 bits)
Compiled Aug 17 2017, 12:18:48 with gcc
By Daniel Diaz
Copyright (C) 1999-2013 Daniel Diaz
| ?- [user].
compiling user for byte code...
even(0).
even(s(s(X))) :- even(X).

user compiled, 3 lines read - 321 bytes written, 3627 ms

yes
| ?- even(X).

X = 0 ? ;

X = s(s(0)) ? ;

X = s(s(s(s(0)))) ? ;

X = s(s(s(s(s(s(0)))))) ?

yes
| ?-

I believe the bug was introduced and fixed sometime between 1.4.4 and the current code in git. It looks related to these messages in the users-prolog mailing list. No fix was subsequently announced, but the current code works.
http://<email address hidden>/msg01032.html
http://<email address hidden>/msg01033.html

This bug makes Zesty's gprolog package unusable. Could you please update it?

Thanks in advance,
Cedric Ware.

Tags: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gprolog (Ubuntu):
status: New → Confirmed
Revision history for this message
Ian Lewis (ijl20) wrote :

Just to emphasize, this bug means that the Prolog programming language is realistically unavailable in all Ubuntu versions since 16.04. The 1.4.5-4.1 build of gprolog has this fundamental crippling bug as reported by the OP - even the most basic Prolog programs will not run - and unfortunately the 1.4.4 make from source also throws up a number of compile errors so it is a specialist job to get that code installed.

Revision history for this message
Ian Lewis (ijl20) wrote :

Here's the simplest failing test example I could come up with, which is close to 'hello world' for prolog :

$ prolog
GNU Prolog 1.4.5 (64 bits)
Compiled Feb 5 2017, 10:30:08 with gcc
By Daniel Diaz
Copyright (C) 1999-2016 Daniel Diaz
| ?- [user].
compiling user for byte code...
p :- q(a).
q(a).

user compiled, 2 lines read - 294 bytes written, 13418 ms

yes
| ?- p.
uncaught exception: error(existence_error(procedure,q/0),p/0)
| ?-

On the query "?- p." gprolog should return with "yes", not the exception.

Revision history for this message
Cedric Ware (cedric.ware) wrote :

Hello,

Thanks for your comment, Ian, and for reminding me again of this bug.

If it can help, I'm attaching a patch that lets the stable gprolog-1.4.4 compile with gcc 6.

OTOH, I'm not sure that this is actually the right place to report bugs, because I suspect Ubuntu uses the Debian package more or less as-is. Correct me if I'm wrong. As it happens, the bug has been reported in Debian (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=861027), and has prevented gprolog to be included in recent stable releases, I guess.

I submitted a follow-up to that bug, wait and see.

Best regards,
Cedric Ware.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Patch against previous version of gprolog (latest stable)." seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Ian Lewis (ijl20) wrote :

thanks - I can confirm gprolog 1.4.4 compiles from source ok on Ubuntu 18.04, and runs without this bug. I wasn't expecting the 1.4.5 bugfix to appear here but thought it would make sense to package 1.4.4 rather than 1.4.5

Revision history for this message
Huan Zhang (victzhang) wrote :

I can confirm this bug still exists on Ubuntu 18.04 as of today.

Changed in gprolog (Debian):
status: Unknown → New
Changed in gprolog (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.