didoudiaz / gprolog

GNU Prolog
Other
106 stars 13 forks source link

real_file_name does not follow symlinks on Windows #66

Closed Jean-Luc-Picard-2021 closed 2 months ago

Jean-Luc-Picard-2021 commented 1 year ago

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'
Jean-Luc-Picard-2021 commented 1 year ago

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.

Jean-Luc-Picard-2021 commented 2 months ago

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.