[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 02/07: ftw: Fix getuid-or-false, getgid-or-false macros.
From: |
Ludovic Courtès |
Subject: |
[Guile-commits] 02/07: ftw: Fix getuid-or-false, getgid-or-false macros. |
Date: |
Mon, 29 Jan 2024 08:47:40 -0500 (EST) |
civodul pushed a commit to branch main
in repository guile.
commit b6866ded2bec4a4a92ec5c36c7525bd8041b29ab
Author: Tomas Volf <wolf@wolfsden.cz>
AuthorDate: Fri Oct 13 18:18:11 2023 +0200
ftw: Fix getuid-or-false, getgid-or-false macros.
Both macros were missing a quote for the procedure call, causing the
actual return value to be compiled into the ftw.go, instead of the
procedure call. Snippet from disassembly of ftw.go does confirm that:
55 (make-immediate 2 3990) ;; 997 at
ice-9/ftw.scm:319:46
56 (make-long-immediate 1 120002) ;; 30000 at
ice-9/ftw.scm:320:46
That effectively prevented ftw from entering directories without access
for others. Simple reproduction:
scheme@(guile-user)> ,use (ice-9 ftw)
scheme@(guile-user)> (mkdir "/tmp/xxxx")
scheme@(guile-user)> (chmod "/tmp/xxxx" #o0700)
scheme@(guile-user)> (ftw "/tmp/xxxx" (lambda (_ __ f) (pk f) #t))
;;; (directory-not-readable)
$1 = #t
scheme@(guile-user)> (system "ls -al /tmp/xxxx")
total 0
drwx------ 1 wolf wolf 0 Oct 11 22:54 .
drwxrwxrwt 1 root root 888 Oct 11 22:54 ..
$2 = 0
The fix is to quote the procedure call, leading to the intended
behavior.
Fixes <https://bugs.gnu.org/55344>.
* module/ice-9/ftw.scm (getuid-or-false): Quote the (getuid).
(getgid-or-false): Quote the (getgid).
* NEWS: Update.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
NEWS | 2 ++
module/ice-9/ftw.scm | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index 0bfbd1dd8..d9068e07b 100644
--- a/NEWS
+++ b/NEWS
@@ -41,6 +41,8 @@ the compiler reports it as "possibly unused".
(<https://bugs.gnu.org/55356>)
** 'read-u8' in (scheme base) now defaults to (current-input-port)
(<https://bugs.gnu.org/62690>)
+** 'ftw' now correctly deals with directory permissions
+ (<https://bugs.gnu.org/55344>)
** Hashing of UTF-8 symbols with non-ASCII characters avoids corruption
(<https://bugs.gnu.org/56413>)
diff --git a/module/ice-9/ftw.scm b/module/ice-9/ftw.scm
index ac6aa6316..8496086a1 100644
--- a/module/ice-9/ftw.scm
+++ b/module/ice-9/ftw.scm
@@ -201,12 +201,12 @@
(define-macro (getuid-or-false)
(if (defined? 'getuid)
- (getuid)
+ '(getuid)
#f))
(define-macro (getgid-or-false)
(if (defined? 'getgid)
- (getgid)
+ '(getgid)
#f))
(define (directory-files dir)
- [Guile-commits] branch main updated (49f24d2bf -> fb1f5e28b), Ludovic Courtès, 2024/01/29
- [Guile-commits] 06/07: Fix loading of custom-ports extension, Ludovic Courtès, 2024/01/29
- [Guile-commits] 02/07: ftw: Fix getuid-or-false, getgid-or-false macros.,
Ludovic Courtès <=
- [Guile-commits] 05/07: Ignore more generated files, Ludovic Courtès, 2024/01/29
- [Guile-commits] 03/07: Delete two config.rpath scripts, Ludovic Courtès, 2024/01/29
- [Guile-commits] 01/07: Add more detailed instructions into the HACKING file., Ludovic Courtès, 2024/01/29
- [Guile-commits] 07/07: Match on correct argument in make-custom-port, Ludovic Courtès, 2024/01/29
- [Guile-commits] 04/07: Deduplicate and sort .gitignore, Ludovic Courtès, 2024/01/29