Skip to content

win32: fix relative symlinks pointing into dirs#5355

Merged
ethomson merged 1 commit intolibgit2:masterfrom
pks-t:pks/win32-relative-symlink-across-dirs
Jan 12, 2020
Merged

win32: fix relative symlinks pointing into dirs#5355
ethomson merged 1 commit intolibgit2:masterfrom
pks-t:pks/win32-relative-symlink-across-dirs

Conversation

@pks-t
Copy link
Copy Markdown
Member

@pks-t pks-t commented Jan 10, 2020

On Windows platforms, we need some logic to emulate symlink(3P) defined
by POSIX. As unprivileged symlinks on Windows are a rather new feature,
our current implementation is comparatively new and still has some
rough edges in special cases.

One such case is relative symlinks. While relative symlinks to files in
the same directory work as expected, libgit2 currently fails to create
reltaive symlinks pointing into other directories. This is due to the
fact that we forgot to translate the Unix-style target path to
Windows-style. Most importantly, we are currently not converting
directory separators from "/" to "".

Fix the issue by calling git_win32_path_canonicalize on the target.
Add a test that verifies our ability to create such relative links
across directories.

Fixes #5252.

On Windows platforms, we need some logic to emulate symlink(3P) defined
by POSIX. As unprivileged symlinks on Windows are a rather new feature,
our current implementation is comparatively new and still has some
rough edges in special cases.

One such case is relative symlinks. While relative symlinks to files in
the same directory work as expected, libgit2 currently fails to create
reltaive symlinks pointing into other directories. This is due to the
fact that we forgot to translate the Unix-style target path to
Windows-style. Most importantly, we are currently not converting
directory separators from "/" to "\".

Fix the issue by calling `git_win32_path_canonicalize` on the target.
Add a test that verifies our ability to create such relative links
across directories.
@ethomson
Copy link
Copy Markdown
Member

Good one, thanks @pks-t

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.

Windows: directory relative symlinks do not work

3 participants