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

Re: [PATCH 2/2] t/Makefile: get UNIT_TESTS list from C sources

From
Adam Dinwoodie <adam@dinwoodie.org>
Date
Jan 31, 2024, 19:13 UTC
Message-ID
<CA+kUOakoMi4wb0=pAbWiRLmSumiQCXewW3S67cM5WJ4tttYFhg@mail.gmail.com>
In-Reply-To
<xmqqeddzfywg.fsf@gitster.g>
On Tue, 30 Jan 2024 at 00:28, Junio C Hamano <gitster@pobox.com> wrote:
Show 18 quoted lines
>
> Adam Dinwoodie <adam@dinwoodie.org> writes:
>
> >> Hmm, good point. It seems like the answer should obviously be "yes", but
> >> Windows CI seemed to pass all the same (and I checked that it indeed ran
> >> the unit tests). Do we only get the $X suffix for MSVC builds or
> >> something? Looks like maybe cygwin, as well.
> >
> > Cygwin will automatically append ".exe" when doing directory listings;
> > a check if the file "a" exists will return true on Cygwin if "a" or
> > "a.exe" exists; a glob for "a*" in a directory containing files "a1"
> > and "a2.exe" will return "a1" and "a2". This causes problems in some
> > edge cases, but it means *nix scripts and applications are much more
> > likely to work without any Cygwin-specific handling. I *think* this
> > logic is carried downstream to MSYS2 and thence to Git for Windows.
>
> Interesting, especially that "a*" is globbed to "a2" and not
> "a2.exe".

My error, sorry! I've just double-checked and Cygwin's globbing will report the file with the .exe extension. I clearly misremembered how this works.

Having looked up a bit more of the implementation is simply that, if Cygwin tries to open a file named "x" and doesn't find it, it will attempt to open "x.exe" before it returns the failure. This means that scripts that call (say) `/usr/bin/env bash` or `cat` or `[ "$x" = "$y" ]` or whatever will broadly Just Work(TM) rather than needing to be rewritten with the extension added. But the behaviour only applies when Cygwin is looking for a specific filename.

Previous: Jeff KingNext: Jeff King
Message 12 of 24 in “some unit-test Makefile polishing”
  1. 0/2 some unit-test Makefile polishingJeff King, Jan 29, 2024
  2. 1/2 Makefile: use order-only prereq for UNIT_TEST_BINJeff King, Jan 29, 2024
  3. SZEDER GáborJan 29, 2024
  4. Junio C HamanoJan 29, 2024
  5. Jeff KingJan 30, 2024
  6. 2/2 t/Makefile: get UNIT_TESTS list from C sourcesJeff King, Jan 29, 2024
  7. Patrick SteinhardtJan 29, 2024
  8. Jeff KingJan 29, 2024
  9. Adam DinwoodieJan 29, 2024
  10. Junio C HamanoJan 30, 2024
  11. Jeff KingJan 30, 2024
  12. Adam DinwoodieJan 31, 2024
  13. Jeff KingJan 30, 2024
  14. Junio C HamanoJan 29, 2024
  15. 0/3 some unit-test Makefile polishingJeff King, Jan 30, 2024
  16. 1/3 Makefile: use mkdir_p_parent_template for UNIT_TEST_BINJeff King, Jan 30, 2024
  17. 2/3 Makefile: remove UNIT_TEST_BIN directory with "make clean"Jeff King, Jan 30, 2024
  18. 3/3 t/Makefile: get UNIT_TESTS list from C sourcesJeff King, Jan 30, 2024
  19. Junio C HamanoJan 31, 2024
  20. Phillip WoodFeb 1, 2024
  21. Junio C HamanoFeb 2, 2024
  22. Johannes SchindelinFeb 2, 2024
  23. Junio C HamanoFeb 3, 2024
  24. Jeff KingFeb 4, 2024

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.