From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id E77E71FE90 for ; Mon, 24 Apr 2017 07:52:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1166288AbdDXHwu (ORCPT ); Mon, 24 Apr 2017 03:52:50 -0400 Received: from cloud.peff.net ([104.130.231.41]:38865 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1166245AbdDXHws (ORCPT ); Mon, 24 Apr 2017 03:52:48 -0400 Received: (qmail 11308 invoked by uid 109); 24 Apr 2017 07:52:44 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.84) with SMTP; Mon, 24 Apr 2017 07:52:44 +0000 Received: (qmail 4190 invoked by uid 111); 24 Apr 2017 07:53:09 -0000 Received: from sigill.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.7) by peff.net (qpsmtpd/0.84) with SMTP; Mon, 24 Apr 2017 03:53:09 -0400 Received: by sigill.intra.peff.net (sSMTP sendmail emulation); Mon, 24 Apr 2017 03:52:42 -0400 Date: Mon, 24 Apr 2017 03:52:42 -0400 From: Jeff King To: Junio C Hamano Cc: SZEDER =?utf-8?B?R8OhYm9y?= , Stefan Beller , Johannes Sixt , David Turner , git@vger.kernel.org Subject: Re: [PATCH] test-lib: abort when can't remove trash directory Message-ID: <20170424075241.ybbq2cpvbmwtdwz7@sigill.intra.peff.net> References: <20170420165230.5951-1-szeder.dev@gmail.com> <20170421201527.wdtxhox3p4g35gex@sigill.intra.peff.net> <20170424014339.nuh7ixlqudfnftzp@sigill.intra.peff.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Sun, Apr 23, 2017 at 09:02:41PM -0700, Junio C Hamano wrote: > >> That looks fine, assuming the answer to the "is the cwd important" > >> question is "no". > > > > And I do think the answer would be "yes", unfortunately. There are > > systems that do not even allow a file to be removed while it is > > open, so... > > In addition to "some platforms may not want cwd removed", this > directory would be where test_at_end_hook_ will be running in, so > we'd better be consistent with the current behaviour. Good point. There's only one caller, but it does care about being in that directory. > Second try that hopefully is much less damaging > > t/test-lib.sh | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/t/test-lib.sh b/t/test-lib.sh > index cb0766b9ee..4e8f511870 100644 > --- a/t/test-lib.sh > +++ b/t/test-lib.sh > @@ -760,12 +760,15 @@ test_done () { > say "1..$test_count$skip_all" > fi > > - test -d "$remove_trash" || > - error "Tests passed but trash directory already removed before test cleanup; aborting" > + if test -z "$debug" > + then > + test -d "$TRASH_DIRECTORY" || > + error "Tests passed but trash directory already removed before test cleanup; aborting" > > - cd "$(dirname "$remove_trash")" && > - rm -rf "$(basename "$remove_trash")" || > - error "Tests passed but test cleanup failed; aborting" > + cd "$(dirname "$TRASH_DIRECTORY")" && > + rm -fr "$TRASH_DIRECTORY" || > + error "Tests passed but test cleanup failed; aborting" > + fi Yeah, that looks good to me. -Peff