Opened 12 hours ago
#1863 new defect
delete-file and delete-file* inconsistency
| Reported by: | fa11-1eaf | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | someday |
| Component: | unknown | Version: | 5.3.0 |
| Keywords: | delete-file delete-file* file-exists stat lstat | Cc: | |
| Estimated difficulty: | trivial |
Description
While trying to delete an invalid symbolic link file (for which the linked file is deleted), delete-file function succeeds, while delete-file* returns false.
I have conducted a research which showed me that file-exists? on such invalid link also returns false, as it calls stat, and, therefore, follows symbolic links.
I have prepared a patch which replaces stat with lstat. If that approach is not acceptable, I can try to fix it in a more preferred way.
How to reproduce:
$ touch some-file
$ ln -s some-file some-link
$ rm some-file
$ csi -e '(import (chicken file)) (print (file-exists? "some-link"))'
