rob piko schreef op di 04-05-2021 om 18:58 [-0400]: > Hello Maxime, > > > * Use O_NOFOLLOW to *not* follow the symbolic link. > > Patch for adding O_NOFOLLOW to guile: > > According to the man pages for the O_NOFOLLOW: > > > If the trailing component (i.e., basename) of pathname is > > a symbolic link, then the open fails, with the error > > ELOOP. Symbolic links in earlier components of the > > pathname will still be followed. > > Sounds like O_NOFOLLOW would not fix the issue if the symlink is found in other parts of the pathname outside of the basename? Indeed! To avoid *all* symlinks, and not only a symlink in the trailing component, you would need to call 'open' with O_NOFOLLOW in a loop. Something like: (let* ((dir (open "/symlinks/acceptable-here" O_RDONLY)) ;; Symlinks are not followed here. (dir* (openat dir "dir" (logior O_RDONLY O_NOFOLLOW))) (file (openat dir* "file" (logior O_RDONLY O_NOFOLLOW)))) (close dir) (close dir*) file) It has been a while since I wrote the patch though, maybe the argument order is a little different. Greetings, Maxime.