Skip to content

Revert bogus bug fix that prevented the deployment of v3.6.7 at first#128

Open
dscho wants to merge 1 commit intogit-for-windows:mainfrom
dscho:unbreak-gawk-when-LC_ALL-is-C
Open

Revert bogus bug fix that prevented the deployment of v3.6.7 at first#128
dscho wants to merge 1 commit intogit-for-windows:mainfrom
dscho:unbreak-gawk-when-LC_ALL-is-C

Conversation

@dscho
Copy link
Member

@dscho dscho commented Mar 4, 2026

When I tried to deploy Git for Windows' MSYS2 runtime v3.6.7, it failed the CI build with a really unhelpful:

        [...]
        GEN      tlsoffsets
      <stdin>:6:37: error: expected initializer before '*' token
      <stdin>:6:41: error: expected unqualified-id before '=' token
      <stdin>:6:71: error: expected unqualified-id before ')' token
      awk: fatal: cannot open file `tlsoffsets' for reading: No such file or directory
      /d/a/MSYS2-packages/MSYS2-packages/msys2-runtime/src/msys2-runtime/winsup/cygwin/scripts/gentls_offsets: line 104: [: -ne: unary operator expected

This despite the fact that MSYS2's own MSYS2 runtime v3.6.7 deployed just fine. The reason is that the gawk update to v5.4.0 unveiled an erroneous bug fix that Git for Windows still carries. The part of the build that was failing was where it generated the tlsoffsets file. Over the course of a day, I reduced this to a small reproducer. In particular, with LC_ALL=C the following invocation:

printf 'void (*func) (int, siginfo_t *, void *);\n' |
gawk '
  {
      # Filter out function names
      print gensub (/\(\*(\w+)\)\s*\([^\)]*\)/, "\\1", "g");
  }
'

does not print the expected:

void func;

but instead:

void (*func) (int, siginfo_t *, void *);

I did verify that reverting the bug fix lets the build succeed again, and that it does not regress on git-for-windows/git#2189: scripts with umlauts in their filenames can still be executed via double-clicking even after reverting. So let's do that.

As a very nice bonus, it reduces the divergence between MSYS2's and Git for Windows' variant of the MSYS2 runtime.

@dscho dscho self-assigned this Mar 4, 2026
This was designed to fix the problem where double-clicking `.sh` scripts
in Windows Explorer with non-ASCII filenames would not execute the
scripts, see git-for-windows/git#2189

However, this patch is broken, as became apparent when I no longer could
build Git for Windows' MSYS2 runtime after the gawk update to v5.4.0.
The part of the build that is failing is where it generated the
`tlsoffsets` file. In particular, with `LC_ALL=C` the following
invocation:

	printf 'void (*func) (int, siginfo_t *, void *);\n' |
	gawk '
	  {
	      # Filter out function names
	      print gensub (/\(\*(\w+)\)\s*\([^\)]*\)/, "\\1", "g");
	  }
	'

does not print the expected:

	void func;

but instead:

	void (*func) (int, siginfo_t *, void *);

I did verify that the scripts with umlauts in their filenames can still
be executed via double-clicking, even after reverting this here patch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho dscho force-pushed the unbreak-gawk-when-LC_ALL-is-C branch from d765f7e to 4c22b03 Compare March 5, 2026 08:36
@dscho dscho marked this pull request as ready for review March 5, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant