From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Maxime Devos Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Bindings to *at functions & allowing more functions to operate on ports Date: Wed, 05 May 2021 12:11:25 +0200 Message-ID: <43055cc9da778fc2388a817489bb6b5b95cde6ae.camel@telenet.be> References: <175c3a6572e832d84927937b309a3095cadf5702.camel@telenet.be> <20210328111732.GC19415@tuxteam.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-9eFRtUkksQjdSU3B84kf" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19460"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.34.2 Cc: guile-devel@gnu.org To: rob piko , tomas@tuxteam.de Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Wed May 05 12:12:00 2021 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1leEVb-0004t6-6k for guile-devel@m.gmane-mx.org; Wed, 05 May 2021 12:11:59 +0200 Original-Received: from localhost ([::1]:49976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leEVa-0000ey-AB for guile-devel@m.gmane-mx.org; Wed, 05 May 2021 06:11:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leEVH-0000eG-T3 for guile-devel@gnu.org; Wed, 05 May 2021 06:11:39 -0400 Original-Received: from laurent.telenet-ops.be ([2a02:1800:110:4::f00:19]:51702) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1leEVF-0000in-BJ for guile-devel@gnu.org; Wed, 05 May 2021 06:11:39 -0400 Original-Received: from ptr-bvsjgyjmffd7q9timvx.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d]) by laurent.telenet-ops.be with bizsmtp id 0yBZ2500W0mfAB401yBZ0k; Wed, 05 May 2021 12:11:33 +0200 In-Reply-To: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1620209494; bh=jyHN8bSCU1jKaz+xdBo8SSmnkQvO8IMnqVlnKz/PBwM=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=LdD1aFXhjXvnsX185j305++8PdQ4Ms4bu8bjm504ObNxfJasJ5T7R0FHVUEAv/xUk SXPUq/T2nlvuJF8RGrf+wXMLAx7fKtr91OC4iu/JE0NnRgG8jTSWPlhbLwgxwc/Efw k9ftr9nrpskzr0Hm+0EpQjIqjLws4dDVUEMcBBQGHvyGUu/rAnZJrip7rmfG93A6SX keHp1/4NUgUJT7Mt2tsFlL+wocNCuhX4F/3fgf3ouCbTsL7QJYvwTUeuDCkToDwUF/ nxix6gm5xGS0avEI+tVHBNrlzLqp4jKNyvbotJ23G4/Xiw+0yfN4n30Zzk75taIBPC MlhMkFvUwDw/A== Received-SPF: pass client-ip=2a02:1800:110:4::f00:19; envelope-from=maximedevos@telenet.be; helo=laurent.telenet-ops.be X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:20759 Archived-At: --=-9eFRtUkksQjdSU3B84kf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable rob piko schreef op di 04-05-2021 om 18:58 [-0400]: > Hello Maxime, >=20 > > * Use O_NOFOLLOW to *not* follow the symbolic link. > > Patch for adding O_NOFOLLOW to guile: >=20 > According to the man pages for the O_NOFOLLOW: >=20 > > 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. >=20 > 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 com= ponent, 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. --=-9eFRtUkksQjdSU3B84kf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYJJvTRccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7vzZAP9dhok47DF3DWmY5WYmuvOTgBZj 9yTyrmGKmgX4U4udrwEA4eotouDgIlbF4scCb/M29zRSb18dP/LGnL2GhiPLkwM= =jq7o -----END PGP SIGNATURE----- --=-9eFRtUkksQjdSU3B84kf--