civodul pushed a commit to branch master
in repository guix.

commit 4e6df8040e539e4635420eef1a2a26af209b614d
Author: Reepca Russelstein <[email protected]>
AuthorDate: Fri Oct 25 01:04:48 2024 -0500

    activation: Create directory with specified perms in ‘mkdir-p/perms’.
    
    There is currently a window of time between when the desired directory is
    created and when its permissions are changed.  During this time, its
    permissions are restricted only by the umask.
    
    Of course, in the "directory already exists" case, this doesn't matter, but 
if
    the directory has been specifically deleted ahead of time so that it is
    created afresh, this is an unnecessary window.
    
    We can avoid this by passing the caller-provided BITS to 'mkdirat' when
    attempting to create the last directory.
    
    * gnu/build/activation.scm (mkdir-p/perms): Create target directory with 
BITS
      permissions.
    
    Change-Id: I03d2c620872e86b6f591abe0f1c8317aa1245383
    Signed-off-by: Ludovic Courtès <[email protected]>
---
 gnu/build/activation.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm
index d1a2876a96..a450578c24 100644
--- a/gnu/build/activation.scm
+++ b/gnu/build/activation.scm
@@ -113,7 +113,9 @@ and bits are set according to the default behaviour of 
'mkdir'."
             ;; If not, create it.
             (catch 'system-error
               (lambda _
-                (mkdirat root head))
+                (if (null? tail)
+                    (mkdirat root head bits)
+                    (mkdirat root head)))
               (lambda args
                 ;; Someone else created the directory.  Unexpected but fine.
                 (unless (= EEXIST (system-error-errno args))

Reply via email to