From d7f64c1f761f352f86217020c84b0adb1482d14c Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 7 Sep 2026 12:31:56 +0900 Subject: [PATCH 1/2] win32: Fix for `NoDefaultCurrentDirectoryInExePath` If the `NoDefaultCurrentDirectoryInExePath` environment variable is set, the current directory won't be part of the search path for the command without path separators. https://learn.microsoft.com/en-us/windows/win32/api/processenv/nf-processenv-needcurrentdirectoryforexepathw#remarks --- win32/Makefile.sub | 2 +- win32/setup.mak | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/win32/Makefile.sub b/win32/Makefile.sub index d24e43fcbb9f20..e9a9c79e300c10 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -1140,7 +1140,7 @@ miniruby$(EXEEXT): $(Q) $(PURIFY) $(CC) $(MAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(LIBS) \ $(OUTFLAG)$@ -link $(LDFLAGS) $(XLDFLAGS) @$(RM) miniruby.lib miniruby.exp - $(Q) miniruby.exe -v + $(Q) .\miniruby.exe -v $(Q) $(LDSHARED_1) $(Q) $(LDSHARED_2) diff --git a/win32/setup.mak b/win32/setup.mak index 062734c3fb3e1c..fbb657023161e4 100644 --- a/win32/setup.mak +++ b/win32/setup.mak @@ -182,7 +182,7 @@ revision_opt = -DRUBY_REVISION=0 verconf.mk: nul @findstr /R /C:"^#define RUBY_ABI_VERSION " $(srcdir:/=\)\include\ruby\internal\abi.h > $(@) - @$(CPP) -I$(srcdir) -I$(srcdir)/include $(revision_opt) <<"Creating $(@)" > $(*F).bat && cmd /c $(*F).bat > $(@) + @$(CPP) -I$(srcdir) -I$(srcdir)/include $(revision_opt) <<"Creating $(@)" > $(*F).bat && cmd /c .\$(*F).bat > $(@) @echo off #define STRINGIZE0(expr) #expr #define STRINGIZE(x) STRINGIZE0(x) From b57404b461ba8bf34e802d86b0db78388216e182 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 7 Sep 2026 20:40:51 +0900 Subject: [PATCH 2/2] CI: Run with NoDefaultCurrentDirectoryInExePath --- .github/workflows/mingw.yml | 1 + .github/workflows/tarball-windows.yml | 1 + .github/workflows/windows.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/mingw.yml b/.github/workflows/mingw.yml index 409a835cae5483..350447a479529a 100644 --- a/.github/workflows/mingw.yml +++ b/.github/workflows/mingw.yml @@ -59,6 +59,7 @@ jobs: CPPFLAGS: '-D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048' LDFLAGS: '-pipe' GITPULLOPTIONS: --no-tags origin ${{ github.ref }} + NoDefaultCurrentDirectoryInExePath: 1 strategy: matrix: diff --git a/.github/workflows/tarball-windows.yml b/.github/workflows/tarball-windows.yml index 940c6db591871b..d74bcf93feb2fe 100644 --- a/.github/workflows/tarball-windows.yml +++ b/.github/workflows/tarball-windows.yml @@ -44,6 +44,7 @@ jobs: OS_VER: windows-${{ matrix.os }} VCPKG_DEFAULT_TRIPLET: x64-windows FEED_URL: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json + NoDefaultCurrentDirectoryInExePath: 1 steps: - run: md build working-directory: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 399d6b24148d53..79d9bdbfa7ccd7 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -58,6 +58,7 @@ jobs: GITPULLOPTIONS: --no-tags origin ${{ github.ref }} VCPKG_DEFAULT_TRIPLET: ${{ matrix.target || 'x64' }}-windows FEED_URL: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json + NoDefaultCurrentDirectoryInExePath: 1 steps: - run: md build