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

Re: [PATCH] t7900: use pwd -P in macOS maintenance test

From
Junio C Hamano <gitster@pobox.com>
Date
May 27, 2025, 17:19 UTC
Message-ID
<xmqqy0uiug1y.fsf@gitster.g>
In-Reply-To
<9e9ed1ce-76dc-536d-56a6-e85e1dfe58c6@chromium.org>
Mark Mentovai <mark@chromium.org> writes:
> Forcing the entire test suite to run from a realpath-canonicalized
> path seems like a blunt instrument, though.
I view it differently.

It is a very effective way to make sure that the tests work for one person does not mysteriously break for another, only due to where they kept the git repository and where in their filesystem they arranged the tests to run. That is not the kind of breakage we want our developers to be scratching their heads about.

The part of the test-lib I showed already was trying to make sure that our idea of $PWD matches the physical world. It did so only for PWD, by doing 'cd -P "$TRASH_DIRECTORY"' early in the test setup sequence, but it did so after setting HOME, leaving it inconsistent between physical and logical world.

Which is the bug that my suggested fix addresses.

Besides the problem we saw in this discussion thread is *not* a bug in Git and its normalization of its working directory, is it? It was a bug in the test script that assumed that $HOME already was normalized, right?

If we want to make sure Git (not its tests, but Git itself) works when (pwd) and (pwd -P) are different, we should have a dedicated test to arrange that for everybody, regardless of where the tester checks out their git repository. We can only do so on symlink capable filesystems, but we do have enough support in the test framework to do so if you want to write such a test.

Previous: Mark MentovaiNext: Mark Mentovai
Message 7 of 19 in “t7900: use pwd -P in macOS maintenance test”
  1. t7900: use pwd -P in macOS maintenance testMark Mentovai, May 23, 2025
  2. Eric SunshineMay 23, 2025
  3. Junio C HamanoMay 23, 2025
  4. Eric SunshineMay 23, 2025
  5. Junio C HamanoMay 23, 2025
  6. Mark MentovaiMay 24, 2025
  7. Junio C HamanoMay 27, 2025
  8. Mark MentovaiMay 23, 2025
  9. Eric SunshineMay 23, 2025
  10. t: run tests from a normalized working directoryMark Mentovai, May 28, 2025
  11. Torsten BögershausenMay 28, 2025
  12. Junio C HamanoMay 30, 2025
  13. Torsten BögershausenMay 31, 2025
  14. Junio C HamanoJun 1, 2025
  15. Mark MentovaiJun 2, 2025
  16. Junio C HamanoJun 2, 2025
  17. Torsten BögershausenJun 3, 2025
  18. Mark MentovaiJun 3, 2025
  19. Junio C HamanoJun 3, 2025

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.