From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 13A2B20601 for ; Thu, 23 May 2019 09:37:08 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 09/26] xapcmd: do not cleanup on errors Date: Thu, 23 May 2019 09:36:47 +0000 Message-Id: <20190523093704.18367-10-e@80x24.org> In-Reply-To: <20190523093704.18367-1-e@80x24.org> References: <20190523093704.18367-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We move the old directory into the new directory, so avoid the situation where a bug or error could cause the tempdir cleanup to run and destroy both our old and new directories. --- lib/PublicInbox/Xapcmd.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PublicInbox/Xapcmd.pm b/lib/PublicInbox/Xapcmd.pm index 999ddd1..81e2f10 100644 --- a/lib/PublicInbox/Xapcmd.pm +++ b/lib/PublicInbox/Xapcmd.pm @@ -32,7 +32,7 @@ sub run { $ibx->umask_prepare; my $old = $ibx->search->xdir(1); -d $old or die "$old does not exist\n"; - my $new = tempdir($cmd->[0].'-XXXXXXXX', CLEANUP => 1, DIR => $dir); + my $new = tempdir($cmd->[0].'-XXXXXXXX', DIR => $dir); my $v = $ibx->{version} || 1; my @cmds; if ($v == 1) { -- EW