swipl-devel icon indicating copy to clipboard operation
swipl-devel copied to clipboard

`absolute_file_name` arities 2 and 3 behave differently for nonexistant path aliases

Open dgelessus opened this issue 2 years ago • 0 comments

absolute_file_name/2 silently fails when passed a nonexistant path alias, whereas absolute_file_name/3 throws an error.

SICStus 4.6.0 throws an error in both cases. That is also the logical behavior IMO, because absolute_file_name/3 defaults to file_errors(error), and arity 2 should behave like arity 3 with no options, unless there's a good reason not to.

[debug]  ?- absolute_file_name(potato(tomato), Abs).
false.

[debug]  ?- absolute_file_name(potato(tomato), Abs, []).
ERROR: source_sink `potato(tomato)' does not exist
ERROR: In:
ERROR:   [13] throw(error(existence_error(source_sink,...),_10202))
ERROR:   [12] '$existence_error'(source_sink,potato(tomato)) at <builddir>/home/boot/init.pl:3908
ERROR:   [11] '$abs_file_error'(potato(tomato),[],_10274{file_type:regular}) at <builddir>/home/boot/init.pl:1271
ERROR:   [10] absolute_file_name(potato(tomato),_10304,[]) at <builddir>/home/boot/init.pl:1207
ERROR:    [9] toplevel_call(user:user: ...) at <builddir>/home/boot/toplevel.pl:1116

dgelessus avatar Aug 03 '21 18:08 dgelessus