emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#66531: closed ([PATCH] ftw: Fix getuid-or-false, getgid-or-false mac


From: GNU bug Tracking System
Subject: bug#66531: closed ([PATCH] ftw: Fix getuid-or-false, getgid-or-false macros.)
Date: Mon, 29 Jan 2024 13:30:01 +0000

Your message dated Mon, 29 Jan 2024 14:28:28 +0100
with message-id <87r0i0p8ub.fsf@gnu.org>
and subject line Re: bug#66531: [PATCH] ftw: Fix getuid-or-false, 
getgid-or-false macros.
has caused the debbugs.gnu.org bug report #66531,
regarding [PATCH] ftw: Fix getuid-or-false, getgid-or-false macros.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
66531: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=66531
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: [PATCH] ftw: Fix getuid-or-false, getgid-or-false macros. Date: Fri, 13 Oct 2023 18:18:11 +0200
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.

This fixes bug 55344.

* module/ice-9/ftw.scm (getuid-or-false): Quote the (getuid).
(getgid-or-false): Quote the (getgid).
---
 module/ice-9/ftw.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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)
-- 
2.41.0




--- End Message ---
--- Begin Message --- Subject: Re: bug#66531: [PATCH] ftw: Fix getuid-or-false, getgid-or-false macros. Date: Mon, 29 Jan 2024 14:28:28 +0100 User-agent: Gnus/5.13 (Gnus v5.13)
Tomas Volf <wolf@wolfsden.cz> skribis:

> 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.
>
> This fixes bug 55344.
>
> * module/ice-9/ftw.scm (getuid-or-false): Quote the (getuid).
> (getgid-or-false): Quote the (getgid).

Applied, thanks!


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]