Ann: SWI-Prolog 8.4.1 (stable)

Dear SWI-Prolog user,

I have uploaded SWI-Prolog 8.4.1 in the stable series. This backports
bug fixes and enhancements without compatibility consequences from the
development series. It does include some new features of the development
series such as the new argv_options/3 commandline argument parser.

Enjoy --- Jan

SWI-Prolog Changelog since version 8.4.0

  • FIXED: Saved state handling of a dict whose first key value (in the
    internal order) and tag are both avoid variables. This patch is less
    invasive than 4de9114a76cd44659591296627e999cf1072d744.

  • FIXED: Be more relaxed about existence of the current predicate
    when pushing and popping the compilation context.

  • ENHANCED: Get version info into the Prolog flag. Now uses CMake rather
    than a shell script and provides a new Prolog flag cmake_build_type.

  • DOC: meta_predicate/1: updated mode declarations.

  • EHNACED: pack_rebuild/1,2 for CMake based packages to use cmake --build and cmake --install for the build and install steps rather
    than calling make, ninja, etc. directly. Suggested by Wouter Beek.

  • MAINTENANCE: Possible segv in retract/1 when compiled using O_DEBUG.

  • FIXED: Possible race conditions between the various ways a thread
    can be joined.

  • FIXED: Do not start a new thread to join garbage collected threads
    while shutting down the system.

  • MAINTENANCE: On a system error we only go into interactive mode if
    both stdin and stderr are connected to a terminal. Otherwise we
    print the message, C and Prolog stack and abort.

  • MAINTENANCE: Use of guarded C-stack using sigaltstack() doesn’t go
    with ASAN. Results in the error below. Disabled guarding the C
    stack when compiling using address sanitizer.

==101190==ERROR:   AddressSanitizer failed to deallocate 0x2000 (8192) bytes at  address 0x6250000b1900
==101190==AddressSanitizer CHECK failed:  ../../../../src/libsanitizer/sanitizer_common/  "(("unable to unmap" && 0)) != (0)" (0x0, 0x0)
  • FIXED: CMake packs must use environment variables.

  • ADDED: Support ninja builds when using CMake

  • FIXED: pack_install/1,2: If we use CMake for configuration, we should
    also build in the CMake directory.

  • TEST: Signalled thread may already be dead.

  • ADDED: pack_install/1,2: provide pack_install(.) to add the local
    directory to the pack registry and build it. Also add option link(true)
    and rebuild(When) to provide more fine control over the build.

  • FIXED: pack_install/1,2: do not remove contents if the package
    registered as a symbolic link.

  • FIXED: memberchk/2 for partial lists where the unbound part is
    constrained. Reported on Discourse by Abramo Bagnara.

  • BUILD: Avoid GCC-11 warning

  • ENHANCED: Protect assertz/1 and friends (compiler) against C-stack

  • ENHANCED: Use setjmp() instead of sigsetjmp() to reduce the overhead
    of the C-stack guarding.

  • MAINTENANCE: Updated C calltree analysis for CMake build and new
    coding style and conventions.

  • FIXED: Fallback to find a place for packages to install executables.

  • FIXED: Hash consistency on pointer sided integers for 64-bit bigendian
    machines. Only affects consistency of term_hash/2 over platforms.

  • FIXED: Checking that an uncaught exception is caught in an outer
    , i.e., nested C<->Prolog callback.

  • FIXED: Make C-stack guarding work in threads.

  • ENHANCED: Use C-stack guarding for read/1 and friends.

  • FIXED: format/2,3: Term printing using ~[kpqw] did not propagate

  • ENHANCED: Handle C-stack overflows gracefully on POSIX targets with

  • ADDED: argv_options/3: allow including longer descriptions as header,
    usage and footer in the usage message.

  • ADDED: argv_options/3: Allow the user to redefine the bindings for
    help. Suggested by @swi.

  • PORT: Alignment on ppc64el. Better version than

  • PORT: Alignment on ppc64el (Debian). See
    ppc64le compilation failure in Alpine for swi-prolog 8.5.0 · Issue #104 · SWI-Prolog/issues · GitHub

  • FIXED: pl_get_uint64() for GMP numbers on 32-bit systems.

  • ADDED: argv_options/3,4: allow for disjunctive types.

  • ADDED: library(prolog_versions) to simplify demanding minimal version
    and features of the hosting Prolog system.

  • ADDED: argv_options/4: options_after_arguments(false) option to
    stop processing options after the first positional argument.

  • ADDED: win_get_user_preferred_ui_languages/2 to get access to the
    user’s preferred UI languages on Windows.

  • INSTALL: Windows: avoid confusing uninstall version message.

  • ENHANCED: Allow loading library(prolog_debug) if spy and/or nospy
    are defined as operators.

  • FIXED: Do not reclaim memory on termination when we failed to terminate
    all threads.

  • ENHANCED: Provide a non-polling process termination procedure for
    systems that do not have sem_timedwait() such as MacOS.

  • ENHANCED: Improve performance for process shutdown on POSIX
    systems that support sem_timedwait() by avoiding a polling loop.
    This typically saves 0.1 second on the elapsed time for short lived

  • ADDED: Allow --no-pce together with -c (compile) to produce
    a state that does not include xpce.

  • FIXED: Retract for retract((a:-true)). Reported by Fernando

  • ADDED: argv_options/3: type term

  • ADDED: argv_options/3 to provide a full featured and lightweight
    alternative to library(optparse).

  • FIXED: format/2 and friends: verify error when emitting rubber.

  • ADDED: format/2 and friends: support ~:|, the colon modifier for
    tab stops to insert a newline if the current column already passed
    the tab stop.

  • FIXED: Issue#896: Claim that memory streams as used by
    e.g. open_string/2 are reported as repositionable. Reported by
    Matthijs van Otterdijk.

  • ENHANCED: Allow 64-bit seek function to work on memory streams.

  • ADDED: Allow stream contol functions to return whether the stream
    is repositionable.

  • FIXED: det/1: avoid false non-determinism claim if all relevant
    choicepoints are debug choicepoints.

  • FIXED: Predicate access in nested transactions for clauses that are
    removed in the parent (or a previous nested) transaction. We must
    inspect the affected clauses of all parent transactions. Reported by
    Eric Zinda.

  • FIXED: Answer subsumption tabling case provided by Annie Liu.

  • ADDED: Predicate property sig_atomic. Currently only for the
    built-in sig_atomic/1.

  • FIXED: Delay signals in prolog_exception_hook/4.

  • ADDED: sig_atomic/1 to run goals protected from signals. This
    predicate used to be available as the undocumented ‘$sig_atomic’/1.
    ‘$sig_atomic’/1 is now available from library(backcomp).

  • ENHANCED: thread_signal/2: reduce the locked section

  • FIXED: thread_wait/2: return when condition is true before this
    predicate is called.

  • FIXED: thread_wait/2: wait_preds option accepted non-predicate

  • ADDED: sandbox: call_delays/2 as safe meta predicate

  • FIXED: Issue#889: swipl --abi-version crashed.

  • ENHANCED: trace/2 to delete that we are tracing this predicate if
    the port list is empty.

  • DOC: Document key pc of prolog_choice_attribute/3

  • FIXED: 91d73fb8a859c6e0f0d97ff553f96903816bc18c triggers another case
    where the falsecount of a node can underflow during re-evaluation.
    Bit dubious.

  • DOC: LaTeX formatting error

Package cpp

  • CLEANUP: SWI-cpp.h: more consistent type handling and silence several
    more casts.

  • COMPATIBILITY: SWI-cpp.h to use static_cast<type>(expression)
    to avoid warnings on modern C++ compilers.

Package http

  • ADDED: JSON writer for dicts now have a hook json_dict_pairs/2 that
    allows the user to select keys from the dict and particularly define
    the order of keys in the resulting JSON.

  • ADDED: http_read_data/4: handle the input_encoding/1 option when
    using to(Type).

  • FIXED: range streams: be careful about race conditions when
    asynchronously finding all streams that refer to OS file handles.

Package jpl

  • BUILD: Silence GCC-11 warning (ugly)

Package mqi

  • UPDATE: Missing file from last commit

  • FIXED: File Handle Leak reported by
    @andrzej-at-mazurkiewicz-org Original bug report is:
    OSError: [Errno 24] Too many open files after 508 iterations of with PrologMQI() as mqi: with mqi.create_thread() as pth: · Issue #13 · SWI-Prolog/packages-mqi · GitHub

    Need to call:
    self._process.exit(None, None, None)

    instead of:

    result = self._process.wait()

    as it will close the stderr/out handles too. Otherwise they will leak
    since they are used and thus opened (but not closed) by the Popen object.

  • TEST: Handle all failures from test_server_options_and_shutdown as
    warnings unless “SWIPL_TEST_FAIL_ON_UNLIKELY=y” This test has lots
    of threading and potential race conditions so it can fail when the
    system is heavily loaded.

    Handle by catching all exceptions and only actually failing if

  • DOC: Update URLs from EricZinda/swiplserver to packages-mqi

  • ADDED: All files needed to actually build the Python ‘swiplserver’
    model and post to so that ‘pip install swiplserver’
    works Includes instructions on how to the build the model in

  • ENHANCED: Use new controlled options and automatic help.

  • ENHANCED: Include dependencies to make mqi run with disabled

  • FIXED: Use argv rather than os_argv. Breaks on new argv_options/3.

Package odbc

  • CMAKE: Requires minimally cmake 3.9

  • TEST: Include ODBC tests based on the environment variable
    SWIPL_TEST_ODBC_DRIVER. Also fixes cleanup of the ODBC tests.

  • FIXED: Ensure statement is closed in two scenarios.

  • FIXED: Properly translate non-ASCII ODBC messages to Unicode.

  • FIXED: Cleanup the remains of old work-arounds or broken MS SQLServer
    SQLColumns() and add a new one. odbc_table_column/3 stops with the
    error Invalid Descriptor Index trying to fetch the column name
    using SQLGetData(). The work-around sets the column with for this
    query to 8K, avoiding SQLGetData(). Thanks to Fernando Sáenz-Pérez
    for reporting and providing access to a server.

Package pengines

  • ENHANCED: Provide CSS style wfs_undefined for undefined answers.

  • ADDED: term_html:portray//2 hook that plays a role similar to portray/1
    for HTML rendering of terms.

Package protobufs

  • FIXED: Issue #15 (long directory name) Shorten directory
    protoc_gen_prolog_pb to gen_pb for R build (R build outputs a warning
    if a the path is more than 100 bytes)

  • FIXED: uint32_codes/2 in mode (-,+) on may return a negative value
    on 32-bit systems.

Package redis

  • TEST: Prevent occasional early termination in test(primes).

  • TEST: Make sure the Redis test group consumers are properly discarded.

Package semweb

  • BUILD: Trick GCC-11 we are not really freeing a non-heap address.

Package sgml

  • FIXED: xml_quote_cdata/3: possible race condition if two threads use
    this for the first time.

Package ssl

  • BUILD: Silence (incorrect) GCC-11 uninitialized warning.

Package xpce

  • PORT: remove Cygwin from targets requiring dllexport Cygwin ld uses
    auto-export by default. Mixing that with dllexport in some cases
    leaves other symbols unexported.

    Signed-off-by: Corinna Vinschen

  • BUILD: Avoid GCC-11 warning.

  • FIXED: Do not setup search path for library(pce) if --no-pce
    is given.