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: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 7C42B1F953 for ; Fri, 3 Dec 2021 17:42:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382402AbhLCRpr (ORCPT ); Fri, 3 Dec 2021 12:45:47 -0500 Received: from cloud.peff.net ([104.130.231.41]:43176 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239496AbhLCRpp (ORCPT ); Fri, 3 Dec 2021 12:45:45 -0500 Received: (qmail 24874 invoked by uid 109); 3 Dec 2021 17:42:20 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Fri, 03 Dec 2021 17:42:20 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 3093 invoked by uid 111); 3 Dec 2021 17:42:20 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Fri, 03 Dec 2021 12:42:20 -0500 Authentication-Results: peff.net; auth=none Date: Fri, 3 Dec 2021 12:42:20 -0500 From: Jeff King To: Junio C Hamano Cc: Philippe Blain , Git mailing list , Derrick Stolee Subject: Re: t7900 failures when $HOME is symlinked Message-ID: References: <4cf14040-c8e1-0f75-0ec4-fd8cf6bed0a5@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Fri, Dec 03, 2021 at 09:10:16AM -0800, Junio C Hamano wrote: > * TRASH_DIRECTORY is originally set to "trash directory." with a > suffix to make it unique across test scripts, but it immediately > gets turned into an absolute path by doing this: > > test -n "$root" && TRASH_DIRECTORY="$root/$TRASH_DIRECTORY" > case "$TRASH_DIRECTORY" in > /*) ;; # absolute path is good > *) TRASH_DIRECTORY="$TEST_OUTPUT_DIRECTORY/$TRASH_DIRECTORY" ;; > esac > > I notice that a root that is not absolute is silently lost during > this process. > > TEST_OUTPUT_DIRECTORY is set to TEST_DIRECTORY that comes from > $(pwd) we saw earlier, or TEST_OUTPUT_DIRECTORY_OVERRIDE, which > is also set to $(pwd) elsewhere, so the case statement does make > it absolute in the end. It just loses --root=* without complaint > which is what I found iffy. I don't think it's lost. It becomes part of $TRASH_DIRECTORY in the first line, so the final line which prepends $TEST_OUTPUT_DIRECTORY makes it relative to that. E.g.: $ cd t $ ./t0000-basic.sh --root=foo --debug [...] $ ls foo trash directory.t0000-basic/ I don't recall planning that in particular (there is not much point in using it unless you are pointing outside the repo, though I guess you could use ../../../foo or similar). But I think it has always worked that way, since f423ef5f2b (tests: allow user to specify trash directory location, 2009-08-09). It was perhaps a little easier to see back then when the intermediate "$test" variable was not the final one. -Peff