Subject: call-with-temporary-directory rarely cleans up after itself
From: Leo Famulari <[email-masked]>
To: [email-masked]
Date: Wed, 11 Jul 2018 14:59:37 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

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