Subject: Re: [bug#77201] [PATCH] guix: substitute-key-authorization: Fix case when acl symlink is broken

From: Ludovic Courtès <[email-masked]>
Date: Tue, 15 Apr 2025 13:30:20 +0200

Hello,

Ian Eure <[email-masked]> writes:

>> -        (if (file-exists? acl-file)
>> +        (if (or (file-exists? acl-file) (symbolic-link? acl-file))
>
> Guile semantics are unhelpful here: `file-exists?' returns #f for a
> broken symlink, but `symbolic-link?' raises an exception if given a
> nonexistent path.

I would go back to the fundamentals:

  (match (and=> (false-if-exception (lstat acl-file)) stat:type)
    (#f ;file does not exist
     …)
    ('symlink
     …)
    (_
     …))

HTH!

Ludo’.