Re: A strong argument for a chase? flag for file-info, and a issue which needs to be considered
hga@xxxxxx 26 Aug 2019 15:38 UTC
>From: Lassi Kortela <xxxxxx@lassi.io>
>Date: Monday, August 26, 2019 10:28 AM
>> If a directory entry is a symlink that points to a file that doesn't
>> exist, file-info as it now stands, as well as with the default of chase?
>> being true if it's added back, will signal an error.
>>
>> What needs some thought is that's a confusing errno and message, "No
>> such file or directory", yet the user can "see" it with directory-files
>> and open/read/close-directory.
>>
>> A strong argument for the chase? flag for file-info is that if we don't
>> add it back, the code for file-info-symlink? becomes exceptionally
>> trivial, the body is just #f because it can never be handed a file-info
>> for a symlink itself.
>Fully agree with all of that. lstat() is often used for reliable code.
>It might even be better for the non-chasing lstat() to be the default
>instead of the chasing stat(). I've often wondered about that when
>coding in C.
Adding chase? with any default to set-file-owner, set-file-group, and
set-file-timespecs isn't particularly important, or at least I can't
recall ever desiring to do any of those operations to a symlink.
Which would make it less confusing to add chase? with a default of #f
only to file-info, and thus default to calling lstat as I too have
done as you have.
- Harold