[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/10: syscalls: Define AT_SYMLINK_NOFOLLOW et al.
From: |
Ludovic Courtès |
Subject: |
02/10: syscalls: Define AT_SYMLINK_NOFOLLOW et al. |
Date: |
Tue, 3 Jul 2018 11:50:14 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 25c7ff6a3ecbaa1e93b38d35c8cbff40b7f4edb8
Author: Ludovic Courtès <address@hidden>
Date: Tue Jul 3 10:52:55 2018 +0200
syscalls: Define AT_SYMLINK_NOFOLLOW et al.
* guix/build/syscalls.scm (AT_FDCWD, AT_SYMLINK_NOFOLLOW, AT_REMOVEDIR)
(AT_SYMLINK_FOLLOW, AT_NO_AUTOMOUNT, AT_EMPTY_PATH): New variables.
* tests/syscalls.scm ("utime with AT_SYMLINK_NOFOLLOW"): New test.
---
guix/build/syscalls.scm | 17 +++++++++++++++++
tests/syscalls.scm | 13 +++++++++++++
2 files changed, 30 insertions(+)
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 25726b8..74cb675 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -46,6 +46,14 @@
MNT_DETACH
MNT_EXPIRE
UMOUNT_NOFOLLOW
+
+ AT_FDCWD
+ AT_SYMLINK_NOFOLLOW
+ AT_REMOVEDIR
+ AT_SYMLINK_FOLLOW
+ AT_NO_AUTOMOUNT
+ AT_EMPTY_PATH
+
restart-on-EINTR
mount-points
swapon
@@ -667,6 +675,15 @@ mounted at FILE."
(* (file-system-block-size fs)
(file-system-blocks-available fs))))
+;; Flags for the *at command, notably the 'utime' procedure of libguile.
+;; From <fcntl.h>.
+(define AT_FDCWD -100)
+(define AT_SYMLINK_NOFOLLOW #x100)
+(define AT_REMOVEDIR #x200)
+(define AT_SYMLINK_FOLLOW #x400)
+(define AT_NO_AUTOMOUNT #x800)
+(define AT_EMPTY_PATH #x1000)
+
;;;
;;; Containers.
diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index 0d07280..3e267c9 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -60,6 +60,19 @@
(any (cute member <> (mount-points))
'("/" "/proc" "/sys" "/dev")))
+(false-if-exception (delete-file temp-file))
+(test-equal "utime with AT_SYMLINK_NOFOLLOW"
+ '(0 0)
+ (begin
+ ;; Test libguile's utime with AT_SYMLINK_NOFOLLOW, which libguile does not
+ ;; define as of Guile 2.2.4.
+ (symlink "/nowhere" temp-file)
+ (utime temp-file 0 0 0 0 AT_SYMLINK_NOFOLLOW)
+ (let ((st (lstat temp-file)))
+ (delete-file temp-file)
+ ;; Note: 'utimensat' does not change 'ctime'.
+ (list (stat:mtime st) (stat:atime st)))))
+
(test-assert "swapon, ENOENT/EPERM"
(catch 'system-error
(lambda ()
- branch master updated (13f5eb3 -> a51cf16), Ludovic Courtès, 2018/07/03
- 02/10: syscalls: Define AT_SYMLINK_NOFOLLOW et al.,
Ludovic Courtès <=
- 01/10: deduplication: Remove 'false-if-system-error', now unused., Ludovic Courtès, 2018/07/03
- 03/10: database: 'reset-timestamps' now correctly handles symlinks., Ludovic Courtès, 2018/07/03
- 04/10: ui: Report file names in 'system-error' exceptions from 'delete-file'., Ludovic Courtès, 2018/07/03
- 05/10: guix system: Make 'init' idempotent again., Ludovic Courtès, 2018/07/03
- 07/10: tests: basic: Wait for /var/run/shepherd/socket to be ready., Ludovic Courtès, 2018/07/03
- 06/10: Revert "packages: Optimize 'package-transitive-supported-systems'.", Ludovic Courtès, 2018/07/03
- 10/10: gnu: Update stellarium to 0.18.0., Ludovic Courtès, 2018/07/03
- 08/10: gnu: Add pocl., Ludovic Courtès, 2018/07/03
- 09/10: gnu: emacs-helm-system-packages: Update to 1.10.0., Ludovic Courtès, 2018/07/03