guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#54762] [PATCH] home: symlink-manager: Use no-follow version of file


From: Maxime Devos
Subject: [bug#54762] [PATCH] home: symlink-manager: Use no-follow version of file-exists?.
Date: Thu, 07 Apr 2022 14:28:11 +0200
User-agent: Evolution 3.38.3-1

Andrew Tropin schreef op do 07-04-2022 om 11:22 [+0300]:
> +         (define (no-follow-file-exists? file) 
> +           "Return #t if file exists, even if it's a dangling
> symlink."
> +           (or (file-exists? file)
> +               (and=> (false-if-exception (lstat file))
> +                      (lambda (x)
> +                        (equal? (stat:type x) 'symlink)))))

Can't this be simplified to

  (define (no-follow-file-exists? file)
    (false-if-exception (lstat file)))

?  Also, do you want to ignore _all_ exceptions, or only the ENOENT and
maybe ENOTDIR system-error?

(catch 'system-error
  (lambda () (lstat file) #t)
  (lambda e
    (if its-a-ENOFILE
        #f
        (apply throw e))))

More concretely, why is ENOMEM, ENAMETOOLONG and EACCESS ignored here?

Greetings,
Maxime.

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]