From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ey7vY-0006MQ-2o for guix-patches@gnu.org; Mon, 19 Mar 2018 23:27:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ey7vU-0004J2-V8 for guix-patches@gnu.org; Mon, 19 Mar 2018 23:27:08 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:34587) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ey7vU-0004Iu-Qs for guix-patches@gnu.org; Mon, 19 Mar 2018 23:27:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ey7vS-0001v2-5h for guix-patches@gnu.org; Mon, 19 Mar 2018 23:27:04 -0400 Subject: [bug#30572] [PATCH 5/7] guix: Rewrite build-docker-image to allow more paths. Resent-Message-ID: From: Chris Marusich References: <20180222102933.4978-1-cmmarusich@gmail.com> <20180315040915.5556-1-cmmarusich@gmail.com> <20180315040915.5556-6-cmmarusich@gmail.com> <20180316232941.3040c051@scratchpost.org> Date: Tue, 20 Mar 2018 04:26:00 +0100 In-Reply-To: <20180316232941.3040c051@scratchpost.org> (Danny Milosavljevic's message of "Fri, 16 Mar 2018 23:29:41 +0100") Message-ID: <87sh8vwhpz.fsf@garuda.local.i-did-not-set--mail-host-address--so-tickle-me> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Danny Milosavljevic Cc: 30572@debbugs.gnu.org, Chris Marusich --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Danny Milosavljevic writes: >> + (define (sanitize path-fragment) >> + (escape-special-chars >> + ;; GNU tar strips the leading slash off of absolute paths before a= pplying >> + ;; the transformations, so we need to do the same, or else our >> + ;; replacements won't match any paths. >> + (string-trim path-fragment #\/) >> + ;; Escape the basic regexp special characters (see: "(sed) BRE syn= tax"). >> + ;; We also need to escape "/" because we use it as a delimiter. >> + "/*.^$[]\\" >> + #\\)) > > I'm not such a fan of using blacklist. Those can easily get out of sync = and > nobody notices. But in this case I guess people take care not to extend > basic regexp special characters in sed (tar) without the user specifying = a flag > requiring it. That's a good point. However, I think we're OK here, since we are in full control over how we invoke tar. To give us full control over how we invoke tar, I specifically took care to hide the fact that we are using tar under the covers to do the transformations. Even if tar silently changes its contract (that seems unlikely to me), we can just change our code accordingly, and callers will be none the wiser. =2D-=20 Chris --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAlqwf0gACgkQ3UCaFdgi Rp3AYg/+JEdbcF+xFgdWdVsr+JXQS3m3Bau4alo07PjGivu/3IsPwek7GLIJyUu0 3s6G0SpSMv/hyuB3wWWP/hzIywWTg/PIlltm48M2ReAwwfpkWx9zfU+aOznu31jx E6FN72LHplrayRYpIlNY3ec0Xo/2vWom2Cud4WWbCMC1F2rnEaL+jVil+p2opqwZ erbYHDAvX5Qp9XjmXBFQ0IK/Adkc5UizE0qeHNf9is2ync36k4e8p12h59Dpyylm X9qa0anAWYGPseLPW0sM9rLHnMI45bHF3JAc0EmG11e8H/U//idWcQZLlJ3aM4ny HwveMVfgvWYGDdb9LysNLTDX3w07V+ZoLSiBEz7TcG719DxHNG0En9kJyC/A+83s 1ArwmiQCVvCDBfWeExhdCbEtD+TZvrL5bs0xk8hMLSxRIPIjw4FyWDFljxIBWAD3 VFKnutXfvFogOJfUcCuXfVNSyh1O7dXBjA1oFz9qQPOGLyqMrvcVFRLY+OrpAnFN GtspAK9sQB8+WKZdw55Cct7/iZcMuy8ps2xJFOblGIAA6jxGf2AqXmJlQhZvEeQc nHbmtEZo0GWg47h039CO09GhdJQmJRu5uOqvOD6QYMX2cTYU+w5hnGldw+Ai0zO/ IPAnwjuCdORtvP8VLl9xY02UHJ4CWTmNFtUkroHdZSFgaVMUfKY= =dzG3 -----END PGP SIGNATURE----- --=-=-=--