SWI-Prolog/swish

tab/1 is sandboxed and can't be run

balaziks opened this issue · 2 comments

Calling tab/1 leads to No permission to call sandboxed tab(_XXX)'`, which is weird since it only prints set number of spaces to the output (which can be simulated using write/1).

Is there something I am missing?

Workaround is to redefine tab/1 at the beginning of a program like so:

:- dynamic tab/1.
tab(0) :- !.
tab(X) :- X \== 0, write(' '), Y is X-1, tab(Y).

or with mitigation of #120

:- dynamic tab/1.
tab(0) :- !.
tab(X) :- X \== 0, write('\x2001'), Y is X-1, tab(Y).

'\x2001' is a different type of Unicode space, which isn't striped in the output.

Added tab/1 to the Pengine I/O emulation library. The reason it doesn't work is that the normal I/O predicates are redefined in library(pengines_io) to emit HTML. Tab/1 was not and therefore you get the original I/O predicate that is protected. Now in the SWI-Prolog git. Should become available with the next release cycle.