Skip to content

Commit 69182bd

Browse files
committed
fix: Look for bash in (git root)/usr/bin not (git root)/bin
This is to help support running them with a shell from the Git for Windows SDK, which, relative to the directory where it's installed in, provides a `usr/bin` directory with a `bash.exe` executable, like the same-named directory in a non-SDK full installation of Git for Windows via the installer or PortableGit or or via package managers such as `scoop` that repackage PortableGit, but unlike those other installations does not provide a `bin` directory. Inside the MSYS2 "Git Bash" provided as part of the Git for Windows SDK, there are both `/bin` and `/usr/bin` directories, but this not related to the `bin` subdirectory of the root of the installation. On both regular Git for Windows "Git Bash" and Git for Windows SDK "Git Bash" environments, `/bin` in the environment is mounted to refer to the same directory as `/usr/bin`. In both, this is separate from `(git root)/bin` as accessed outside that environment. For example, in an SDK "Git Bash": $ mount C:/git-sdk-64 on / type ntfs (binary,noacl,auto) C:/git-sdk-64/usr/bin on /bin type ntfs (binary,noacl,auto) C:/Users/ek/AppData/Local/Temp on /tmp type ntfs (binary,noacl,posix=0,usertemp) C: on /c type ntfs (binary,noacl,posix=0,user,noumount,auto) $ cygpath -w /bin /usr/bin C:\git-sdk-64\usr\bin C:\git-sdk-64\usr\bin And in a non-SDK "Git Bash": $ mount C:/Users/ek/AppData/Local/Temp on /tmp type ntfs (binary,noacl,posix=0,usertemp) C:/Users/ek/scoop/apps/git/2.48.1 on / type ntfs (binary,noacl,auto) C:/Users/ek/scoop/apps/git/2.48.1/usr/bin on /bin type ntfs (binary,noacl,auto) C: on /c type ntfs (binary,noacl,posix=0,user,noumount,auto) $ cygpath -w /bin /usr/bin C:\Users\ek\scoop\apps\git\2.48.1\usr\bin C:\Users\ek\scoop\apps\git\2.48.1\usr\bin The former has another `bin` directory alongside the `usr` directory on disk, containing shims for `git.exe`, `sh.exe`, and `bash.exe`, while the latter does not, but in neither case does `/bin` inside Git Bash refer to it. This other `bin` directory was formerly used to find `bash.exe` to run test fixture scripts. A possible reason to continue using `(git root)/bin` would be if the shims modify the environment in a way that makes the fixtures operate better.
1 parent 572fb96 commit 69182bd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/tools/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ fn bash_program() -> &'static Path {
663663
.map(OsString::from)
664664
.map(|mut raw_path| {
665665
// Go down to where `bash.exe` usually is. Keep using `/` separators (not `\`).
666-
raw_path.push("/bin/bash.exe");
666+
raw_path.push("/usr/bin/bash.exe");
667667
raw_path
668668
})
669669
.map(PathBuf::from)

0 commit comments

Comments
 (0)