cisco / ChezScheme

Chez Scheme
Apache License 2.0
6.97k stars 983 forks source link

Predicates on paths should respect link following option on Windows #716

Open FrankHB opened 1 year ago

FrankHB commented 1 year ago

https://github.com/cisco/ChezScheme/blob/c048ad8423791de4bf650fca00519d5c2059d66e/c/io.c#L127-L195

In these implementations, followp is not used at all for Win32. This looks wrong, because Windows supports symbolic links similar enough to POSIX. There is no reason to keep the inconsistent behaviors. Further, the behavior is also not the default of POSIX, due to the fact that GetFileAttributesExW does not follow links (i.e. it is more like lstat but not stat). These gliches are not documented.

burgerrg commented 1 year ago

On Windows 11, I used mklink to create a symbolic link from foo.ss to bar.ss. In Chez Scheme 9.5.8, (file-exists? "bar.ss") returned #t. However, (load "bar.ss") failed with "no such file or directory".

This means that GetFileAttributesExW is following the link, but whatever Chez Scheme calls to open the file is not.

Do you know how to modify S_file_existsp to use followp on Windows?