Summary
delete-file and delete-file* inconsistency
Metadata
- Id: 0a29b9e359dbb02a937726e59b995c4ada4ada4f
- Trac id: 1864
- Type: defect
- Reporter: fa11-1eaf
- Owner:
- Cc:
- Status: closed
- Component: unknown
- Estimated difficulty: trivial
- Resolution: duplicate
- Priority: minor
- Milestone: someday
- Version: 5.3.0
- Changetime: 2026-01-02 15:22:19 UTC
- Created: 2026-01-01 09:54:42 UTC
- Keywords: delete-file delete-file* file-exists stat lstat
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"))'
Changes and comments
[2026-01-02 15:22:19 UTC] sjamaan changed status from new to closed
[2026-01-02 15:22:19 UTC] sjamaan set resolution to duplicate
[2026-01-02 15:22:19 UTC] sjamaan wrote:
Dupe of #1863