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

Expose the "deep-copy" symlink behavior via a new winsymlinks mode #28

Merged
merged 2 commits into from
Oct 22, 2020

Conversation

dscho
Copy link
Member

@dscho dscho commented Oct 21, 2020

This is a companion PR for msys2/msys2-runtime#16.

dscho added 2 commits October 21, 2020 13:53
…/folders.

The original patch to change the symbolic link behavior to create deep
copies instead did so in a bit of a hacky way: it used the
`WSYM_sysfile` code path, not introducing a separate mode. This makes it
impossible for users to ask for Cygwin's behavior (and it also poses a
maintenance burden: for example, we had to specifically disable Cygwin's
code to prefer to create WSL-style symlinks whenever possible instead of
using the original Cygwin hack to use special-formed system files).

Proposed new commit message when rebasing the MSYS2 patches on top of
the next Cygwin runtime version:

Instead of creating Cygwin symlinks, use deep copy by default

The new `winsymlinks` mode `deepcopy` (which is made the default) lets
calls to `symlink()` create (deep) copies of the source file/directory.

This is necessary because unlike Cygwin, MSYS2 does not try to be its
own little ecosystem that lives its life separate from regular Win32
programs: the latter have _no idea_ about Cygwin-emulated symbolic links
(i.e. system files whose contents start with `!<symlink>\xff\xfe` and
the remainder consists of the NUL-terminated, UTF-16LE-encoded symlink
target).

To support Cygwin-style symlinks, the new mode `sysfile` is introduced.

Co-authored-by: Johannes Schindelin <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
Cygwin started to use WSL-style symbolic links by default.

Since MSYS2 decided to patch the `WSYM_sysfile` mode to make deep copies
instead, that logic had to be disabled specifically.

But now that we introduced a separate mode (`WSYM_deepcopy`) for that,
and use that by default, we can re-enable Cygwin's code so that users
wishing to experience Cygwin's symbolic link behavior can do so by
setting `MSYS=winsymlinks:sysfile`.

Essentially, this drops the patch "Don't create WSL symlinks for MSYS2".

Signed-off-by: Johannes Schindelin <[email protected]>
@dscho dscho force-pushed the winsymlinks-deepcopy branch from 83186b2 to 8a52b9d Compare October 21, 2020 11:54
@dscho dscho merged commit 38ef7ed into git-for-windows:main Oct 22, 2020
@dscho dscho deleted the winsymlinks-deepcopy branch October 22, 2020 08:59
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