git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: t7900 failures when $HOME is symlinked

From
Jeff King <peff@peff.net>
Date
Dec 3, 2021, 17:42 UTC
Message-ID
<YapW/CfjFiPvsVbj@coredump.intra.peff.net>
In-Reply-To
<xmqq1r2tty13.fsf@gitster.g>
On Fri, Dec 03, 2021 at 09:10:16AM -0800, Junio C Hamano wrote:
Show 18 quoted lines
>  * 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 5 in “t7900 failures when $HOME is symlinked”
  1. Philippe BlainDec 3, 2021
  2. Junio C HamanoDec 3, 2021
  3. Jeff KingDec 3, 2021
  4. Junio C HamanoDec 5, 2021
  5. Philippe BlainDec 3, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.