didoudiaz/gprolog

real_file_name does not follow symlinks on Windows

Closed this issue · 2 comments

Is there a way to retrieve a real file name in GNU Prolog,
that results from following symlinks? Take this scenario of
a file symlink on Windows:

>dir foo
<SYMLINK>      f4.pl [..\bar\f3.pl]

I only get:

/* GNU Prolog 1.5.0 */
?- file_property('C:\\<dir>\\foo\\f4.pl', X).
X = real_file_name('C:/<dir>/foo/f4.pl') ? 

Whereas nodeJS gives me:

/* Node.js v20.7.0 */
> fs.realpathSync("C:\\<dir>\\foo\\f4.pl");
'C:\\<dir>\\bar\\f3.pl'

The bug doesn't appear for other attributes, like here:

?- file_property('<dir>\\foo\\f3.pl', last_modification(X)).
X = dt(2023,10,14,17,16,14)

?- file_property('<dir>\\bar\\f4.pl', last_modification(X)).
X = dt(2023,10,14,17,16,14)

It seems to use stat and not lstat.

Possibly need to close this ticket anyway, this GitHub seems
to be completely dead, just like GNU Prolog. The ticket
was opened 12 months ago. It was neither classified by

severity nor otherwise touched by any GNU developer.