GNU bug report logs -
#52454
[PATCH 0/4] Ensure correct ownership of directory trees in services.Hello Guix,
Previous Next
Full log
View this message in rfc822 format
* guix/build/syscalls.scm (lchown): New procedure.
---
guix/build/syscalls.scm | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 63bd017d1d..1c432507c3 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -8,6 +8,7 @@
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org>
;;; Copyright © 2021 Chris Marusich <cmmarusich <at> gmail.com>
;;; Copyright © 2021 Tobias Geerinckx-Rice <me <at> tobias.gr>
+;;; Copyright © 2021 Brice Waegeneire <brice <at> waegenei.re>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -118,6 +119,7 @@ (define-module (guix build syscalls)
scandir*
getxattr
setxattr
+ lchown
fcntl-flock
lock-file
@@ -1275,6 +1277,20 @@ (define* (scandir* name #:optional
(lambda ()
(closedir* directory)))))
+(define lchown
+ (let ((proc (syscall->procedure int "lchown" (list '* int int))))
+ (lambda (file owner group)
+ "As 'chown', change the ownership and group of the file referred to by
+FILE to the integer values OWNER and GROUP but doesn't dereference symbolic
+links. Unlike 'chown' this doesn't support port or integer file descriptor
+via 'fchown'."
+ (let-values (((ret err)
+ (proc (string->pointer file) owner group)))
+ (unless (zero? ret)
+ (throw 'system-error "lchown" "~S: ~A"
+ (list file (strerror err))
+ (list err)))))))
+
;;;
;;; Advisory file locking.
--
2.34.0
This bug report was last modified 3 years and 174 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.