Ann: SWI-Prolog 8.5.8

Dear SWI-Prolog user,

SWI-Prolog 8.5.8 is available for download. This version comes with
a lot of internal cleanup from @dmchurch, several enhancements to the
debugger and some bugfixes. Highlights:

  • MODIFIED: No longer allow the , to appear as an unquoted atom. I.e,
    f(,) is no longer valid syntax and must be f(’,’) as required
    by the ISO standard.
  • Several enhancements to the GUI debugger: display update issues
    (X11 version), handle $/0, retry in parent frames, source
    position management, etc.
  • Moved sources to C11 (from C99) to simplify several internal
    code details. @dmchurch.
  • Code cleanup for systems that do not provide signal handling
    or if we do not want to use signal handling. Part of cleanup
    WASM support. @dmchurch.
  • Renamed the clp(QR) helper modules to clpqr_<old name> as
    these modules used to have names that easily conflicts such as
    class. This patch may result in regression. Please test if
    you depend on library(clpq) or library(clpr)

And a quite a more bug fixes. See detailed ChangeLog below.

Enjoy --- Jan

SWI-Prolog Changelog since version 8.5.7

  • FIXED: call_residue_vars/2: possible spurious reported variables
    because the trail entry was removed but the variable was not reclaimed
    due to a frozen stack.

  • ENHANCED: better support for platforms without signals. This adds an
    alternate alerting path when running on a non-Windows system without
    sig_alert, using a C11 mutex and condition variable. Obviously this
    loses the “interrupt blocking system call” semantics, but it allows
    thread_sigwait to park itself while waiting for another thread’s

    A few tests needed changing:

    1. When running without signals on non-Windows, popen(cat-2) will set
      SIGPIPE to ignored manually, since there’s no other way to avoid
      that signal.
    2. The signal_nested tests needed an extra call port so they could
      proactively check for virtual signals.
    3. The D_BREAK tests simply don’t work. It’s slightly too big of
      a can of worms for me to look into for this commit, so I simply
      disabled that test suite on signal-free systems.

    A couple package tests needed adjustments as well:

    1. clib:test_af_unix was using an interrupting signal to stop the
      server thread, so I’ve changed it to auto-exit on signal-free
    2. ssl:ssl_certificates was closing the client before reading the
      server’s response, which caused a SIGPIPE on the server, so I
      added a read-and-check to the test to drain the buffer.

    For testing purposes, the no-signals build can be approximated on a
    system built with signal support by passing the --no-signals and
    –sigalert=0 arguments to swipl on the command line.

  • ADDED: on_signal/3 now takes value ‘ignore’ This allows for requesting
    the SIG_IGN disposition, and also unifies the SIGPIPE behavior with
    the other initially-prepared signals. Technically, this could be
    considered a backwards-incompatible change. However, for this to
    actually affect someone’s working code, they would have to

    1. Redefine the system predicate ignore/1,
    2. Call on_signal(Sig, _, ignore), AND
    3. Expect ignore(Signal) to do something besides ignoring Signal;

    and in that case I think we can all agree they’ve brought this trouble
    upon themselves. :slight_smile:

    Also adds SIGPIPE’s default disposition to the docs.

  • MODIFIED: fixing SIG_PROLOG_OFFSET at 32, per docs This also introduces
    a set of macros to interact with the pending signal mask which should
    hopefully ease refactoring if and when we change which signals swipl
    supports, like adding support for system signals over 31.

  • MODIFIED: Do not allow for an comma to appear as an unquoted atom.

  • MODIFIED: switching core libswipl code to C11 This allows for a
    standards-compatible implementation of the LD macros that is guaranteed
    to compile down to a simple reference even at -O0. I’ve also added
    some code that, at least in my testing, makes print LD work again
    in GDB and any debugger that uses it as a backend.

  • PORT: adding O_SIGNALS define in config.h This provides a single define
    to check if Prolog’s signal-handling is enabled, rather than checking
    each of HAVE_SIGNAL etc. This also makes the existence and use of
    GD->signals.sig_alert consistent on whether SIG_ALERT is defined.

  • PORT: Do not depend on SIGINT if signal support is disabled.

  • PORT: Get optional symbols via weak linking This unifies the tcmalloc
    and ptmalloc linking code and also allows systems without dlsym(),
    like WASM, to expose the malloc-implementation predicates, so long
    as the linker is capable of resolving weak symbols.

  • PORT: Issue#939: TLD_alloc() undefined error on Win32. @mgodan.

  • FIXED: Gui tracer for inlined unification with SSU clauses, e.g.
    p(X), X = aap(N) => writeln(N).

  • FIXED: Allow tracing test predicates that are inlined into the VM.

  • FIXED: Make gui tracer handle inlined head unifications.

  • FIXED: rule/3 for => rules that have the unification moved into the
    head and listing/1 for such SSU clauses.

  • FIXED: Preproc/build errors Adding a couple GCC builtins to the config
    tests, using them to force short-circuiting of _LD_WITH_FALLBACK even
    in low-optimization modes (e.g. Clang in DEBUG configuration).

    Also adding a few missing-but-used defines to config.h.cmake
    and fixing an unbalanced #ifdef pair that got added in f3b79d6.

  • FIXED: Consider /0 a breakable instruction. This fixes the debugger for clauses holding /0.

  • FIXED: Avoid instantiation error on =…/2 when analysing clause
    positions with incomplete information.

  • SANDBOX: SWISH issue#147: Allow for copy_term/4.

  • FIXED: Allow retry from the body of => rules.

  • ENHANCED: Avoid tracing inside spy/1, nospy/1 and related debug
    control predicates.

  • FIXED: Issue#935: package manager: download location of git archives

  • DOC: Remove obsolete reference of break/1 trace port

  • FIXED: Tracer retry on a parent frame. Notably causes problems if
    retrying runs cleanup handlers.

Package clib

  • TEST: test_af_unix works without signals

  • FIXED: memory_file_to_atom/3: do not trap an assertion if the encoding
    is not supported but raise a domain error instead.

  • FIXED: tcp_connect/3 and other predicates that rely on
    nbio_get_sockaddr() to initialize the unused part of the address.

Package clpqr

  • MODIFIED: renamed internal modules with names that may easily conflict
    to clpqr_ followed by the old name. As as result the attributes
    on variables have also be renamed. Should not affect code unless
    applications use explicitly qualified calls or directly manipulate
    the attributes.

  • ENHANCED: Faster dump/3 implementation.

Package http

  • FIXED: Ping and pong frames may contain non-utf8 “Application Data”

Package libedit

  • MODIFIED: Don’t do any signal-handling if O_SIGNALS is disabled

Package mqi

  • FIXED: On a multi-user system, running the MQI test suite fails if
    you’re the second user to do that. Reported by @dmchurch

  • FIXED: Goals are now expanded when used in MQI as they are on the
    top level. Found by @Losbarthos

  • FIXED: Fix bug in docs that used old (invalid) parameters to Python

  • FIXED: Updated Python library on to match this version
    swiplserver · PyPI

Package nlp

  • MODIFIED: Tokenize +digits as [+, int]. This is consistent with
    read/1 parsing +42 into +(42).

Package ssl

  • TEST: test_ssl won’t SIGPIPE without signals

  • PORT: Override OPENSSL_OS_LIBS with cmake -Detc. For some reasons,
    RTools42 needs libz included in the OPENSSL_OS_LIBS

Package xpce

  • FIXED: edit or create the Prolog preferences file from the swipl-win

  • FIXED: Occasional lack of display update, notably in the graphical
    debugger. This fix is a work-around that disables an early abort of the
    repaint cycle if a new event arrives. It is not clear why this fixes
    the redraw issue. This needs to be investigated further. Applications
    that wish the old behaviour can use send(@display_manager, test_queue, @on).

  • FIXED: Delay geometry request for windows with a given geometry to
    happen after processing the MapNotify event (X11 only). This seems to
    avoid a 5 sec delay that sometimes happens in the XtGeometryRequest()