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

Re: [PATCH] t1308: do not get fooled by symbolic links to the source tree

From
Stefan Beller <sbeller@google.com>
Date
Jun 2, 2016, 23:23 UTC
Message-ID
<CAGZ79kY1ygqd4VmwMj4AGTxo2bO6HFKoShzv6S2MxFq6QNjM1w@mail.gmail.com>
In-Reply-To
<20160602231619.GA11277@sigill.intra.peff.net>
On Thu, Jun 2, 2016 at 4:16 PM, Jeff King <peff@peff.net> wrote:
Show 27 quoted lines
> On Thu, Jun 02, 2016 at 03:15:39PM -0700, Junio C Hamano wrote:
>
>> When your $PWD does not match $(/bin/pwd), e.g. you have your copy
>> of the git source tree in one place, point it with a symbolic link,
>> and then "cd" to that symbolic link before running 'make test', one
>> of the tests in t1308 expects that the per-user configuration was
>> reported to have been read from the true path (i.e. relative to the
>> target of such a symbolic link), but the test-config program reports
>> a path relative to $PWD (i.e. the symbolic link).
>>
>> Instead, expect a path relative to $HOME (aka $TRASH_DIRECTORY), as
>> per-user configuration is read from $HOME/.gitconfig and the test
>> framework sets these shell variables up in such a way to avoid this
>> problem.
>
> Looks good.
>
>   Acked-by: Jeff King <peff@peff.net>
>
> To prevent this in the future, I switched my default --root= to point to
> a symlink. I wonder if we could do something in the test suite, though,
> as we did long ago by introducing "trash directory" with a space to
> catch corner cases.
>
> I guess it would be something like:
>
>   if test_have_prereq SYMLINKS

IIUC this would need each test to be marked with SYMLINKS when testing with symlinks is desired. Marking a test with that is easily forgotten, so I'd rather do it by default as:

if (system supports symlinks):
Show 8 quoted lines
>   then
>         mkdir "$TRASH_DIRECTORY.real" &&
>         ln -s "$TRASH_DIRECTORY.real" "$TRASH_DIRECTORY"
>   else
>         mkdir "$TRASH_DIRECTORY"
>   fi
>
> but there may be some other tweaks required (e.g., for cleanup).

I like the idea of testing with symlinks. (Does it have performance issues when everything goes through symlinks?)

On the other hand if we do tests by default in a symlinked path, we could introduce errors more easily in non-symlinked path, but that is what developers use for developing (I guess), so it's not as likely?

Thanks, Stefan

Show 6 quoted lines
>
> -Peff
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous: Jeff KingNext: Jeff King
Message 8 of 14 in “What's cooking in git.git (May 2016, #09; Tue, 31)”
  1. Junio C HamanoMay 31, 2016
  2. Torsten BögershausenJun 2, 2016
  3. Junio C HamanoJun 2, 2016
  4. Junio C HamanoJun 2, 2016
  5. Jeff KingJun 2, 2016
  6. t1308: do not get fooled by symbolic links to the source treeJunio C Hamano, Jun 2, 2016
  7. Jeff KingJun 2, 2016
  8. Stefan BellerJun 2, 2016
  9. Jeff KingJun 3, 2016
  10. Johannes SixtJun 3, 2016
  11. Jeff KingJun 3, 2016
  12. Johannes SixtJun 3, 2016
  13. Torsten BögershausenJun 3, 2016
  14. Johannes SchindelinJul 14, 2016

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.