GNU bug report logs - #78378
[PATCH 0/2] home: services: Build "files" union allowing dangling symlinks.

Previous Next

Package: guix-patches;

Reported by: Sergey Trofimov <sarg <at> sarg.org.ru>

Date: Sun, 11 May 2025 16:02:02 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


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

From: Sergey Trofimov <sarg <at> sarg.org.ru>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Hilton Chain <hako <at> ultrarare.space>,
 Janneke Nieuwenhuizen <janneke <at> gnu.org>,
 Tanguy Le Carrour <tanguy <at> bioneland.org>, 78378 <at> debbugs.gnu.org,
 Andrew Tropin <andrew <at> trop.in>
Subject: Re: [bug#78378] [PATCH 2/2] home: services: Build "files" union
 allowing dangling symlinks.
Date: Mon, 19 May 2025 12:00:30 +0200
Hi Ludovic
Ludovic Courtès <ludo <at> gnu.org> writes:

> Hi Sergey,
>
> Sergey Trofimov <sarg <at> sarg.org.ru> writes:
>
>> * gnu/home/services.scm (files->files-directory): Build file union
>> without checking for existence of included items.
>>
>> * tests/guix-home.sh: Verify symlinking files out of store works.
>>
>> Change-Id: I94054003f4a6be944252ce7a397cf56f0b979554
>
> [...]
>
>> @@ -343,7 +343,21 @@ (define (files->files-directory files)
>>    ;; leading to a build failure of "files.drv".
>>    (assert-no-duplicates files)
>>  
>> -  (file-union "files" files))
>> +  ;; Compute the file-union allowing dangling symlinks
>> +  ;; This enables creating symlinks to locations out of store
>> +  (computed-file
>> +   "files"
>> +   (with-imported-modules '((guix build utils))
>> +     #~(begin
>> +         (use-modules (guix build utils)
>> +                      (ice-9 match))
>> +         (mkdir #$output)
>> +         (chdir #$output)
>> +         (for-each (match-lambda
>> +                     ((target source)
>> +                      (mkdir-p (dirname target))
>> +                      (symlink source target)))
>> +                   '#$files)))))
>
> Instead of more or less duplicating ‘file-union’, how about adding a
> #:dangling-symlinks? argument to ‘file-union’ that would default to #f?
>
> When set to #t, the ‘stat’ call would not be emitted.
>
> That would reduce code duplication and make the intent clearer IMO.
>
> Ludo’.

I've applied your suggestion in v1.




This bug report was last modified 58 days ago.

Previous Next


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