unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#55344: ftw thinks readable directories are unreadable if "other" don't have read permission
@ 2022-05-10  0:25 SeerLite via Bug reports for GUILE, GNU's Ubiquitous Extension Language
  2022-05-17 16:03 ` angry rectangle
  0 siblings, 1 reply; 2+ messages in thread
From: SeerLite via Bug reports for GUILE, GNU's Ubiquitous Extension Language @ 2022-05-10  0:25 UTC (permalink / raw)
  To: 55344

ftw incorrectly thinks that if other users don't have the read 
permission then the owner can't read it either. This also affects ntfw.

Guile version: 3.0.8
Machine type: x86_64-pc-linux-gnu
guile@3.0.8 from Guix

To reproduce: Create 2 directories, one with rwxrwxrwx permissions and 
another with rwxrwx---. Then pass them to ftw and notice it won't 
recurse because it thinks they're directory-not-readable.

scheme@(guile-user)> (passwd:uid (getpw (getlogin)))
$1 = 1001
scheme@(guile-user)> (stat:uid (stat "readable-dir"))
$2 = 1001
scheme@(guile-user)> (stat:uid (stat "also-readable-dir"))
$3 = 1001
scheme@(guile-user)> (format #f "~o" (stat:perms (stat "readable-dir")))
$4 = "777"
scheme@(guile-user)> (format #f "~o" (stat:perms (stat 
"also-readable-dir")))
$5 = "770"
scheme@(guile-user)> (stat "readable-dir")
$6 = #(24 61374845 16895 1 1001 998 0 0 1652140343 1652140343 1652141421 
4096 0 directory 511 216530924 216530924 1652141421)
scheme@(guile-user)> (stat "also-readable-dir")
$7 = #(24 61374847 16888 1 1001 998 0 0 1652140345 1652140345 1652141426 
4096 0 directory 504 20542871 20542871 1652141426)
scheme@(guile-user)> (ftw "readable-dir" (lambda (filename statinfo 
flag) (display flag) (newline) #t))
directory
$8 = #t
scheme@(guile-user)> (ftw "also-readable-dir" (lambda (filename statinfo 
flag) (display flag) (newline) #t))directory-not-readable
$9 = #t





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#55344: ftw thinks readable directories are unreadable if "other" don't have read permission
  2022-05-10  0:25 bug#55344: ftw thinks readable directories are unreadable if "other" don't have read permission SeerLite via Bug reports for GUILE, GNU's Ubiquitous Extension Language
@ 2022-05-17 16:03 ` angry rectangle
  0 siblings, 0 replies; 2+ messages in thread
From: angry rectangle @ 2022-05-17 16:03 UTC (permalink / raw)
  To: 55344

(hmm... resending this because it didnt work. hopefully i'm doing it right this time.)

It looks like guile's compiler and optimizer could be replacing the `getuid' and `setuid' calls with constant, compile-time values.

Here is a test I performed:
1. Make directory with 770 owned by root and the `guixbuild' group. When guile is compiled with guix, I think the process is done under one of the guixbuilder<XX> users who have the `guixbuild' group.
2. Run guile under my regular user.
3. Try to `ftw' that directory. ftw detects it as a readable directory and then ends up throwing a "permission denied" error because it's not actually readable.

If I compile guile manually under my regular user and try ftw on a different user, I observe the results that support my conclusion.

System info:
Guile 3.0.8.13-cc455
guix on amd64





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-17 16:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10  0:25 bug#55344: ftw thinks readable directories are unreadable if "other" don't have read permission SeerLite via Bug reports for GUILE, GNU's Ubiquitous Extension Language
2022-05-17 16:03 ` angry rectangle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).