From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 11 15:00:00 2018 Received: (at submit) by debbugs.gnu.org; 11 Jul 2018 19:00:00 +0000 Received: from localhost ([127.0.0.1]:55884 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fdKLH-0007Tf-SB for submit@debbugs.gnu.org; Wed, 11 Jul 2018 15:00:00 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52807) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fdKLG-0007TT-8W for submit@debbugs.gnu.org; Wed, 11 Jul 2018 14:59:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fdKLA-0006hG-63 for submit@debbugs.gnu.org; Wed, 11 Jul 2018 14:59:53 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:50668) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fdKLA-0006h8-0N for submit@debbugs.gnu.org; Wed, 11 Jul 2018 14:59:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fdKL8-0006ig-Dt for bug-guix@gnu.org; Wed, 11 Jul 2018 14:59:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fdKL4-0006dB-Ii for bug-guix@gnu.org; Wed, 11 Jul 2018 14:59:50 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:53911) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fdKL4-0006cg-DN for bug-guix@gnu.org; Wed, 11 Jul 2018 14:59:46 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id AD2C821D25; Wed, 11 Jul 2018 14:59:44 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 11 Jul 2018 14:59:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=famulari.name; h=content-type:date:from:message-id:mime-version:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=L/Ycn13acWNNE2 q7o/lrVuomUHmR4rOUuM9swlyC9cI=; b=yTpK2QBFfYS/0aPUnxOjDNxYAkEldG 1XpbIMqG0cNgrR3CjV5nfMCFJRDIdxBD0kr3UVOt5+4ED3yvaTsqu3V611/K66a7 ceOVnWX9M56KNHnAe2KAEU9Z8Fbcb69JZnNLxWOr0/duOcKLq2Tqny0DfBvSlmbG H865+pP25eaSw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=L/Ycn13acWNNE2q7o/lrVuomUHmR4rOUuM9swlyC9cI=; b=HATMvhun 5Dz9P4qOTD1IFqbEY6ocSOGp3O8eVrumoT77VlZtPyJlU54wO0FDBvjEhIFYQi9z U/VazTZNt4gWA9p08hc0dT4R9T2aeWyJs864vvKRDWg7jMjb+/RSGr2RbD41sCLm 8/KnIvCjmvZAByd88nE/acwz4OGJhvrDfwzOSU5p4bkKKSbaWEgMxWEvgPTDoGga bb8lQcfesNL/vxZJmGfK/xwLKma/0HuqyDma1WWGSf6Bc9OFFtHf9spO+gYXn7u9 GdhmFV2Z26VL8XcuEhM7KQ2ELcPnxGAgBRU8Pls90XOUbpZzLf0sKW1B7cND5OUM NzqkY0W+sGTkKQ== X-ME-Proxy: X-ME-Sender: Received: from localhost (c-76-124-202-137.hsd1.pa.comcast.net [76.124.202.137]) by mail.messagingengine.com (Postfix) with ESMTPA id 27EA5E45C9 for ; Wed, 11 Jul 2018 14:59:44 -0400 (EDT) Date: Wed, 11 Jul 2018 14:59:37 -0400 From: Leo Famulari To: bug-guix@gnu.org Subject: call-with-temporary-directory rarely cleans up after itself Message-ID: <20180711185937.GA16510@jasmine.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5mCyUwZo2JvN/JJP" Content-Disposition: inline User-Agent: Mutt/1.10.0 (2018-05-17) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.1 (-----) --5mCyUwZo2JvN/JJP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline While testing something, I noticed that temporary directories created with ((guix utils) call-with-temporary-directory) were not being deleted. This procedure is documented to delete the directories after execution: "Call PROC with a name of a temporary directory; close the directory and delete it when leaving the dynamic extent of this call." It uses rmdir, which is documented as follows: "Remove the existing directory named by path. The directory must be empty for this to succeed." [0] I think this is a case where one expects the directory to be deleted as with `rm -rf`, regardless of whether or not it is empty. Should we alter the call-with-temporary-directory procedure to use ((guix build utils) delete-file-recursively)? [0] https://www.gnu.org/software/guile/manual/html_node/File-System.html#index-rmdir --5mCyUwZo2JvN/JJP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAltGU5UACgkQJkb6MLrK fwh8wxAA1wolIirt3aXo1K8Osy1DqBQwmik9gA/eQol4RxWdSc2hH0trux6Z55Lw D5sKWpRsS/s92oT+TNX/raWJ0Wuajc3lxrzCJpKvg1jw58m0vKbVIvYb8Sv66IF7 LfkHeH55/Q0f42HmBG8ONPttb9ZUs/pE+cy1jUZqS8LJPxamhzP10jlarHAUE3aV nAXFwukt3AcN9RvnsfvnwFRlPCmo6Ue+Q3Otm86XE5FXCVq9RGboj3sUXFGWVy1g SzcifNzmnTa31nbuaHlX0WQCefOxosEbnx5cjs8Pzeo5zmTGe7fuJHX9pV7WonRq A5iOKr4g2Mw/I49t1/JFVkoSzquXsWQJvgHdb7MdlhnSXjFEj1KNRyf0MUYcBYh0 LnyG8wX8uW4Hki1/xyRDH6mFMxdOP37K7b6KMrB4jT4JnMyo7E61ea13ksOGIrg5 ZVqCXdJuQh3UwiNhW0OQZfN7b7pvj4fnesEYJArF9sYmt1w9Fnaztmk2AUqtatsA 2HPBW/u8xk3Mzb7mTThKD0vVV7CDFeqCj5o/fx+dEVVvMPXp3YV8nnn4vzRxWhc9 za5F7C/xpEi2w57WHUvOgB+SKvi/hwR4MUHHulbjXIlpbNXkyWkr7Yygwet7tvWq ONxXc4tYdrfIHHX+PKP+ALjxNjvuSqKbp2ke/niNE2S4opFwc0Q= =I5hX -----END PGP SIGNATURE----- --5mCyUwZo2JvN/JJP-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 12 11:37:33 2018 Received: (at 32126) by debbugs.gnu.org; 12 Jul 2018 15:37:33 +0000 Received: from localhost ([127.0.0.1]:57256 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fddet-0004k2-3e for submit@debbugs.gnu.org; Thu, 12 Jul 2018 11:37:33 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48660) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fdder-0004jn-80 for 32126@debbugs.gnu.org; Thu, 12 Jul 2018 11:37:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fddej-0004ap-3Q for 32126@debbugs.gnu.org; Thu, 12 Jul 2018 11:37:24 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:44981) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fddei-0004ai-W3; Thu, 12 Jul 2018 11:37:21 -0400 Received: from [193.50.110.117] (port=45284 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fddei-0002oF-IU; Thu, 12 Jul 2018 11:37:20 -0400 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Leo Famulari Subject: Re: bug#32126: call-with-temporary-directory rarely cleans up after itself References: <20180711185937.GA16510@jasmine.lan> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 24 Messidor an 226 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Thu, 12 Jul 2018 17:37:18 +0200 In-Reply-To: <20180711185937.GA16510@jasmine.lan> (Leo Famulari's message of "Wed, 11 Jul 2018 14:59:37 -0400") Message-ID: <87pnzsv51t.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 32126 Cc: 32126@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) Hi Leo, Leo Famulari skribis: > Should we alter the call-with-temporary-directory procedure to use > ((guix build utils) delete-file-recursively)? Yes, definitely. Note that you can alter (guix utils) without fear of a full rebuild, so you can go ahead and do that in =E2=80=98master=E2=80=99. Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 12 20:51:45 2018 Received: (at 32126) by debbugs.gnu.org; 13 Jul 2018 00:51:45 +0000 Received: from localhost ([127.0.0.1]:57551 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fdmJF-00057V-GM for submit@debbugs.gnu.org; Thu, 12 Jul 2018 20:51:45 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:43767) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fdmJD-00057K-78 for 32126@debbugs.gnu.org; Thu, 12 Jul 2018 20:51:43 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B9DC321B36; Thu, 12 Jul 2018 20:51:42 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 12 Jul 2018 20:51:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=famulari.name; h=cc:content-type:date:from:message-id:mime-version:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=5nBKAnoVXqY/Hq 0wYcT/yalXCtpMBKf6+iF/pwSe2N4=; b=GIYGrSakX/NwhqRMksROYNd9LqWf6Q cjKl+EiT5hUPc1JSDgORa+/ZW44Mda1AknjSp9y002S1wEul9CaHymZrJxdbxugr c5iBft2ibeB4Q4cFHWBpo6nIyF9f2bUgHjwMh6o36BDAwRhDsl3/vL9UatsxteRz VliqsfkBNdf7o= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:message-id :mime-version:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=5nBKAnoVXqY/Hq0wYcT/yalXCtpMBKf6+iF/pwSe2N4=; b=ShwbOASg O4rbTpOaymtYhPW5/tI438BiD6MIkpkPPEuqpAONPZ6umJrlZAoo1zkNGnLpESou malD4NZma0V/PScW5B2d0cS6Om0cYRSw3Syzi0d6MJGFBJ7128mjA8490hl5b+wk rnyRS1beUrwBn5Bs3NDcmRfqNtlUzcKi1PRkO/8B/RQAgaH9vXYr4G5je6HOgp+Y omgD3plVzBm2ujb4nWqfGgwy9hNXbfwdQ58/ypES5yqbRod04coT9VcWOsL1a2Nz UQbqr0XOoSWm0zVAg5vDdhuu1y8l4ZI06/cC+aA1jipxrk/rwMmXWO59Jpu7lc3p nLQ7u6AniX5d+A== X-ME-Proxy: X-ME-Sender: Received: from localhost (c-76-124-202-137.hsd1.pa.comcast.net [76.124.202.137]) by mail.messagingengine.com (Postfix) with ESMTPA id 0CA82E414A; Thu, 12 Jul 2018 20:51:42 -0400 (EDT) Date: Thu, 12 Jul 2018 20:51:36 -0400 From: Leo Famulari To: 32126@debbugs.gnu.org Subject: RE: call-with-temporary-directory rarely cleans up after itself Message-ID: <20180713005136.GA22011@jasmine.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Bn2rw/3z4jIqBvZU" Content-Disposition: inline User-Agent: Mutt/1.10.0 (2018-05-17) X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 32126 Cc: Ludovic =?iso-8859-1?Q?Court=E8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Bn2rw/3z4jIqBvZU Content-Type: multipart/mixed; boundary="sm4nu43k4a2Rpi4c" Content-Disposition: inline --sm4nu43k4a2Rpi4c Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Here's a patch that copies the ((guix build utils) delete-file-recursively) procedure and uses it in ((guix utils) call-with-temporary-directory). However, with the patch there is an error in the test 'gexp->script #:module-path': ------ actual-value: #f actual-error: + (system-error + "lstat" + "~A: ~S" + ("No such file or directory" + "/tmp/guix-directory.6CrC8B/guix/base32.scm") + (2)) result: FAIL ------ Continuing to investigate... --sm4nu43k4a2Rpi4c Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-utils-Really-clean-up-temporary-directories.patch" Content-Transfer-Encoding: quoted-printable =46rom e3181f30ca0711e79aab9d71d798344dfb4636b5 Mon Sep 17 00:00:00 2001 =46rom: Leo Famulari Date: Wed, 11 Jul 2018 20:24:29 -0400 Subject: [PATCH] utils: Really clean up temporary directories. * guix/utils.scm (delete-file-recursively): New variable. (call-with-temporary-directory): Use DELETE-FILE-RECURSIVELY instead of RMDIR. --- guix/utils.scm | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/guix/utils.scm b/guix/utils.scm index f934b6ed1..9e260c90c 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -33,6 +33,7 @@ #:use-module (srfi srfi-35) #:use-module (srfi srfi-39) #:use-module (ice-9 binary-ports) + #:use-module (ice-9 ftw) #:autoload (rnrs io ports) (make-custom-binary-input-port) #:use-module ((rnrs bytevectors) #:select (bytevector-u8-set!)) #:use-module (guix memoization) @@ -620,6 +621,32 @@ call." (false-if-exception (close out)) (false-if-exception (delete-file template)))))) =20 +;; Copied from (guix build utils) +(define* (delete-file-recursively dir + #:key follow-mounts?) + "Delete DIR recursively, like `rm -rf', without following symlinks. Don= 't +follow mount points either, unless FOLLOW-MOUNTS? is true. Report but ign= ore +errors." + (let ((dev (stat:dev (lstat dir)))) + (file-system-fold (lambda (dir stat result) ; enter? + (or follow-mounts? + (=3D dev (stat:dev stat)))) + (lambda (file stat result) ; leaf + (delete-file file)) + (const #t) ; down + (lambda (dir stat result) ; up + (rmdir dir)) + (const #t) ; skip + (lambda (file stat errno result) + (format (current-error-port) + "warning: failed to delete ~a: ~a~%" + file (strerror errno))) + #t + dir + + ;; Don't follow symlinks. + lstat))) + (define (call-with-temporary-directory proc) "Call PROC with a name of a temporary directory; close the directory and delete it when leaving the dynamic extent of this call." @@ -631,7 +658,7 @@ delete it when leaving the dynamic extent of this call." (lambda () (proc tmp-dir)) (lambda () - (false-if-exception (rmdir tmp-dir)))))) + (false-if-exception (delete-file-recursively tmp-dir)))))) =20 (define (with-atomic-file-output file proc) "Call PROC with an output port for the file that is going to replace FIL= E. --=20 2.18.0 --sm4nu43k4a2Rpi4c-- --Bn2rw/3z4jIqBvZU Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAltH95UACgkQJkb6MLrK fwg3Ag/8CVwxPcVkiW2UfgcBZRs4seRyb+7UIkjj2tPAAeMnl18oJsj4mqt9WEOh HPtknFRoww2MJG9Xt/j8T1kY4B2jI3zLrivX0p3VfuYGEQNxEGg4iwEsvA4jGxPm bZeVkPYpXeQ4l9hjepGcL3G6U3OK9my9abxCkdoBHP9g04tybutrCFjjwsf4yOLa JPhuHQ7uzse3UCVTAEE3K6HzhLkRdzQQOHrh5OtYJ2eK4lixBW5euCKMX1LADUpu /9CxXGUPi8Ky2CggQny8JUH+zoFWqUdl3mKRQzE7fAYuNNkv357+U91ifbSMKwsJ JHJWIH1dStIPpuYgcAsIBXf+V2k3Crj0E9PJ76Lf3SDjz6nRmcgClRAchhoQTSt1 sqbwUjxFOoA0aqCNoWBG5OJ3ks5XhuR/rQj0g7rNzPVkPrY3xzjXyN273jX3b0mJ Q72eVq7I8nUfNVqUmeiD1CEexxuCuaXMamzoXPfNi7U9DpM5XIXd0WMrkTU9Vo1o 0Kt7oZ7O9IBqAjC3gcZQ79fHD0eDHcCiUoyJ4UkThAudQpXgZ+HyDmKELe9heevm JhGEcLZhp5lm0D1xS/qltcyVyA56oGEiDbtL7Q35WMB40ME6hTbM6JOomkVWa00b rztg4ZACny3gSr4HCkLm/My8oO1W78c/5msFwZWHSTgIvFO/UPg= =M22g -----END PGP SIGNATURE----- --Bn2rw/3z4jIqBvZU-- From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 13 04:27:50 2018 Received: (at 32126) by debbugs.gnu.org; 13 Jul 2018 08:27:50 +0000 Received: from localhost ([127.0.0.1]:57648 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fdtQc-0001E5-0r for submit@debbugs.gnu.org; Fri, 13 Jul 2018 04:27:50 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49194) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fdtQY-0001Dr-Iq for 32126@debbugs.gnu.org; Fri, 13 Jul 2018 04:27:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fdtQQ-0003oO-6V for 32126@debbugs.gnu.org; Fri, 13 Jul 2018 04:27:41 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:59198) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fdtQQ-0003nx-0G; Fri, 13 Jul 2018 04:27:38 -0400 Received: from [193.50.110.117] (port=53854 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fdtQP-0003xJ-F0; Fri, 13 Jul 2018 04:27:37 -0400 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Leo Famulari Subject: Re: call-with-temporary-directory rarely cleans up after itself References: <20180713005136.GA22011@jasmine.lan> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 25 Messidor an 226 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 13 Jul 2018 10:27:35 +0200 In-Reply-To: <20180713005136.GA22011@jasmine.lan> (Leo Famulari's message of "Thu, 12 Jul 2018 20:51:36 -0400") Message-ID: <87sh4nmtfs.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 32126 Cc: 32126@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, Leo Famulari skribis: > However, with the patch there is an error in the test 'gexp->script > #:module-path': > > ------ > actual-value: #f > actual-error: > + (system-error > + "lstat" > + "~A: ~S" > + ("No such file or directory" > + "/tmp/guix-directory.6CrC8B/guix/base32.scm") > + (2)) > result: FAIL > ------ Funny. That test turned out to work thanks to the brokenness of =E2=80=98call-with-temporary-directory=E2=80=99: since it=E2=80=99s a monad= ic return, the actual code was executed after we=E2=80=99d left the =E2=80=98call-with-temporary-= directory=E2=80=99 extent, yet it expected to be able to access files from that temporary directory. This change fixes it: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/tests/gexp.scm b/tests/gexp.scm index 83fe81154..31c7ce22f 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -948,7 +948,7 @@ (return (and (zero? (close-pipe pipe)) (= (expt n 2) (string->number str))))))) -(test-assertm "gexp->script #:module-path" +(test-assert "gexp->script #:module-path" (call-with-temporary-directory (lambda (directory) (define str @@ -961,23 +961,24 @@ (define-public %fake! ,str)) port))) - (mlet* %store-monad ((exp -> (with-imported-modules '((guix base32)) - (gexp (begin - (use-modules (guix base32)) - (write (list %load-path - %fake!)))))) - (drv (gexp->script "guile-thing" exp - #:guile %bootstrap-guile - #:module-path (list directory))) - (out -> (derivation->output-path drv)) - (done (built-derivations (list drv)))) - (let* ((pipe (open-input-pipe out)) - (data (read pipe))) - (return (and (zero? (close-pipe pipe)) - (match data - ((load-path str*) - (and (string=? str* str) - (not (member directory load-path)))))))))))) + (run-with-store %store + (mlet* %store-monad ((exp -> (with-imported-modules '((guix base32)) + (gexp (begin + (use-modules (guix base32)) + (write (list %load-path + %fake!)))))) + (drv (gexp->script "guile-thing" exp + #:guile %bootstrap-guile + #:module-path (list directory))) + (out -> (derivation->output-path drv)) + (done (built-derivations (list drv)))) + (let* ((pipe (open-input-pipe out)) + (data (read pipe))) + (return (and (zero? (close-pipe pipe)) + (match data + ((load-path str*) + (and (string=? str* str) + (not (member directory load-path))))))))))))) (test-assertm "program-file" (let* ((n (random (expt 2 50))) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > From e3181f30ca0711e79aab9d71d798344dfb4636b5 Mon Sep 17 00:00:00 2001 > From: Leo Famulari > Date: Wed, 11 Jul 2018 20:24:29 -0400 > Subject: [PATCH] utils: Really clean up temporary directories. > > * guix/utils.scm (delete-file-recursively): New variable. > (call-with-temporary-directory): Use DELETE-FILE-RECURSIVELY instead of > RMDIR. Instead of duplicating =E2=80=98delete-file-recursively=E2=80=99, you can t= ake it directly from (guix build utils). There=E2=80=99s already a #:use-module c= lause at the top. Thanks, Ludo=E2=80=99. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 13 17:34:40 2018 Received: (at 32126-done) by debbugs.gnu.org; 13 Jul 2018 21:34:40 +0000 Received: from localhost ([127.0.0.1]:59306 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fe5i4-0007S6-5E for submit@debbugs.gnu.org; Fri, 13 Jul 2018 17:34:40 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:54217) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fe5i0-0007Rw-NL for 32126-done@debbugs.gnu.org; Fri, 13 Jul 2018 17:34:37 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 530F021B42; Fri, 13 Jul 2018 17:34:36 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 13 Jul 2018 17:34:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=famulari.name; h=cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= mesmtp; bh=B3cmJ/QMz0dqU+XJkDPAJ5TGYxtqdP1SnyaZoBdgqBg=; b=gFtFG RjmImK3IkHdhfUR8k+Gn+YJl4HUCprBp7BqLyrdBQ/77XeqqlwILkTAovZLZ0YCe Gofhf/FRy0RBpFgYI0xRiSUXxokcLpVCzfNIb+T4WFQQ4YeurMg/0Ri/4Sa4hQgb TLGkK+TumgbmY3KDLyOIqLvkuv/XegFqPOzP14= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=B3cmJ/QMz0dqU+XJkDPAJ5TGYxtqd P1SnyaZoBdgqBg=; b=EuIipM8IpUGd4QtXhE6wsBXxv8DNuPm5pqQuPcK9LY4bM JJtFhJNp80Oyc5LFL34wwluhBozyYLjj5QASngU0RojSoAIp8wi9CnwVofdknqSk stWKLZm8CxvR/+i/VCBnkFXwyzz7E86+Upgj2xvNlBjsPryTOVev+/G/OfIF47G1 bQeYS39PXoMVk00PRwWTvNFQ9Zd+pFEos8ILIDP+CHDDNfY6iLLfz+VkToWpUHyJ v9F3yNFd8cxMZPcf2AG36CvJ8G3Ony+wDWCI8bWUJFpyxe2MpaqmuMQSsCHaOu0/ OLd1VAK0E6oanVr1s60KkznxWouQrZIBFwtEyt6iw== X-ME-Proxy: X-ME-Sender: Received: from localhost (c-76-124-202-137.hsd1.pa.comcast.net [76.124.202.137]) by mail.messagingengine.com (Postfix) with ESMTPA id D10C4E44F1; Fri, 13 Jul 2018 17:34:35 -0400 (EDT) Date: Fri, 13 Jul 2018 17:34:30 -0400 From: Leo Famulari To: Ludovic =?iso-8859-1?Q?Court=E8s?= Subject: Re: bug#32126: call-with-temporary-directory rarely cleans up after itself Message-ID: <20180713213430.GA30184@jasmine.lan> References: <20180711185937.GA16510@jasmine.lan> <87pnzsv51t.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sdtB3X0nJg68CQEu" Content-Disposition: inline In-Reply-To: <87pnzsv51t.fsf@gnu.org> User-Agent: Mutt/1.10.0 (2018-05-17) X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 32126-done Cc: 32126-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --sdtB3X0nJg68CQEu Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 12, 2018 at 05:37:18PM +0200, Ludovic Court=C3=A8s wrote: > Hi Leo, >=20 > Leo Famulari skribis: >=20 > > Should we alter the call-with-temporary-directory procedure to use > > ((guix build utils) delete-file-recursively)? >=20 > Yes, definitely. Note that you can alter (guix utils) without fear of a > full rebuild, so you can go ahead and do that in =E2=80=98master=E2=80=99. Great, pushed as 27f7cbc91d1963118e44b14d04fcc669c9618176. --sdtB3X0nJg68CQEu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAltJGuYACgkQJkb6MLrK fwhrPBAAl3Oa5SIgMQXpf4kKXX0YQssjdxSFCWUh/F1xGhQgHrmnO3lRcNmt4dWn 4zn+Zn/oOt5JmsCmtvHGi+CiY9c+WLcdsFJP+4YU4ciHRd4sO3S4WyvbUHurVKe1 qYDKa9XuuGAB27p79cnXyJgPqTjAWdwk6/FbHk3Cn5V6ZsGYEKZ9JMdJSWdGrJGT 3qSjcYTnjzpdJs2lOoXm9/X8naLsCEeBJrxq1NDcrGl1hwrpaoMFk60xEgrmUayK CzeJAswT+FqDB+rHhj966RUUAZbZn+KDPdJnjEtk447UMIcoF0kIWyhj6qmaGjFb m8ZuCi42KTtHPFaacPVbT6pMTLSZf/Qt0xzkMrREMzVszyUNtapQfhqm4oLlWKu3 fyBANy4hSchdMQzZKoumLnNGyNQ85EuW/ku2R7cWiss41JPZtv+f8/ao0BduH7b0 tiTQhE1WYjKBXaww+Z8+TlT7ld7y08WOjEb+CZu1kBytf6OV7t6rIYAcN9c2Az8Q EyHvs5p3cXl3SZoA/L4aGc3f9j/xxvaPLc5j1/hD4VOguqNjjAfYPZbISRTMGg7h JKsdDZv6DYA//+MxHzw4tKsjHfXBcSBuxWWlykfK4DhEDW2UI9ND4P7nGCK4+iHd vJ6Famn6nQZY5JL1oWBufPzOQa6HKJfWrS6yXjhgdQSzd9hkfK4= =MFOI -----END PGP SIGNATURE----- --sdtB3X0nJg68CQEu-- From unknown Sun Jun 15 09:02:10 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 11 Aug 2018 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator