GNU bug report logs - #77201
[PATCH] guix: substitute-key-authorization: Fix case when acl symlink is broken

Previous Next

Package: guix-patches;

Reported by: Rutherther <rutherther <at> ditigal.xyz>

Date: Sun, 23 Mar 2025 09:49:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 77201 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> chbouib.org>
To: Rutherther <rutherther <at> ditigal.xyz>
Cc: 77201 <at> debbugs.gnu.org, Ian Eure <ian <at> retrospec.tv>
Subject: Re: [bug#77201] [PATCH] guix: substitute-key-authorization: Fix
 case when acl symlink is broken
Date: Wed, 16 Apr 2025 16:11:35 +0200
Hi,

Rutherther <rutherther <at> ditigal.xyz> writes:

>>   (match (and=> (false-if-exception (lstat acl-file)) stat:type)
>>     (#f ;file does not exist
>>      …)
>>     ('symlink
>>      …)
>>     (_
>>      …))
>
> This definitely helps, thanks, I am still not that skilled in Scheme, so
> I wouldn't think about false-if-exception, and using match would also be
> hard for me to figure out.
>
> I have this now (untested for now)
> ```
> (match (and=> (false-if-exception (lstat acl-file)) stat:type)
>           (#f #f) ; File doesn't exist

Indentation is off (see above.)  Also (I’m nitpicking!), margin comment
should not be a full sentence, so rather:

  (#f #f)  ;file doesn't exist

>           ('symlink ; Delete symlink pointing to store; backup otherwise.
>            (if (or (store-file-name? (readlink acl-file)) ; Store symlink
>                    (not (file-exists? acl-file))) ; Broken symlink
>                (delete-file acl-file)
>                (rename-file acl-file (string-append acl-file ".bak"))))
>           (_ ; Backup
>            (rename-file acl-file (string-append acl-file ".bak"))))

Should be good!

> I will probably also make this into a reusable function in guix utils
> build,

Maybe not: (guix build utils) is rarely updated because it entails world
rebuilds, which also means that it’s interfaces must be very generic and
bullet-proof.  So I would keep it local for now.

Thanks,
Ludo’.




This bug report was last modified 18 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.