Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicitly support the /dev/fd symlink and friends #41

Merged
merged 1 commit into from
Feb 23, 2022

Conversation

dscho
Copy link
Member

@dscho dscho commented Feb 19, 2022

Let's avoid having to play games in setup-git-for-windows-sdk and in the Git for Windows installer that need to call post-install.bat, just to make sure that those four symlinks in /dev/ exist: fd, stdin, stdout and stderr.

This also opens the door a little wider for offering Git for Windows as a Microsoft Store application. Only a little though.

This finally addresses the challenge I offered to capable volunteers.

Bash has a very convenient feature that is called process substitution
(e.g. `diff -u <(seq 0 10) <(seq 1 11)`). To make this work, Bash
requires the `/dev/fd` symlink to exist, and MSYS2 and Cygwin therefore
create this symlink (together with the `stdin`, `stdout` and `stderr`
ones) upon start-up.

This strategy is a bit incompatible with Git for Windows, which wants to
install the pseudo root into a write-protected area, concretely in
`C:\Program Files\Git`.

This strategy is _also_ incompatible with the idea of providing MinGit
as a `.zip` file (because there is no standard way to represent symlinks
in `.zip` files, and besides, older Windows versions would potentially
lack support for them anyway).

Let's side-step this completely by creating those symlinks implicitly,
similar to the way `/dev/` is populated with special devices.

The diff is misleadlingly large due to the re-generated `devices.cc`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho
Copy link
Member Author

dscho commented Feb 21, 2022

This also will address the recent build failures of the git-sdk-64-minimal job, e.g. (https://dev.azure.com/Git-for-Windows/git/_build/results?buildId=94758&view=results](here). The root cause is that we use the Bash-ism "process redirection" in Git's completion now, which means we need this /dev/fd/ symlink.

Note: Git's CI does not fail because the setup-git-for-windows-sdk Action explicitly creates that symlink. We will need to adjust that Action to accommodate pre-emptively for this here PR, otherwise it will start to fail because it assumes that that symlink does not yet exist.

@dscho
Copy link
Member Author

dscho commented Feb 21, 2022

I sent this to the Cygwin mailing list for review.

@dscho
Copy link
Member Author

dscho commented Feb 23, 2022

I sent this to the Cygwin mailing list for review.

The patches have been accepted! Let's take them into Git for Windows early.

@dscho dscho merged commit 9f15ca2 into git-for-windows:main Feb 23, 2022
@dscho dscho deleted the virtual-dev-fd branch February 23, 2022 16:58
dscho added a commit to dscho/msys2-runtime that referenced this pull request May 3, 2022
Implicitly support the /dev/fd symlink and friends
dscho added a commit to dscho/msys2-runtime that referenced this pull request May 6, 2022
Implicitly support the /dev/fd symlink and friends
dscho added a commit that referenced this pull request May 8, 2022
Implicitly support the /dev/fd symlink and friends
dscho added a commit that referenced this pull request May 8, 2022
Implicitly support the /dev/fd symlink and friends
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