Skip to content

Commit 4c43de3

Browse files
committed
symlinks: some fixes
* note since when symlinks exist * note hardlinks/junctions as well * in known issues, repeate the context to be more clear * some typos
1 parent 336cb99 commit 4c43de3

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

web/docs/symlinks.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ in MSYS2 and not in Cygwin.
4343
This is a short primer for native Windows symlinks in case you haven't used them
4444
before or are only familiar with them on Unix systems.
4545

46-
Symlink support in Windows existed for a long time, but creating them was
46+
Symlink support in Windows existed since Windows Vista, but creating them was
4747
initially only possible with administrator accounts. Starting with Windows 10
48-
(~2016) it is now possible to create symlinks with your normal user account if
49-
you have the ["Developer Mode"
48+
(~2016) it is possible to create symlinks with your normal user account if you
49+
have the ["Developer Mode"
5050
enabled](https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development).
5151
Existing symlinks that were created by an administrator account, or with the
52-
"Developer Mode" enabled, can be used and deleted by normal users without rights
52+
"Developer Mode" enabled, can be used and deleted by normal users without the right
5353
to create symlinks themselves.
5454

55-
Compare to Unix symlinks, the Windows symlinks come in a "directory" and a
55+
Compared to Unix symlinks, the Windows symlinks come in a "directory" and a
5656
"file" type. If you create a file symlink to a directory, or vice versa, or if
5757
the target type changes after the symlink is created, the symlink will be
5858
broken.
@@ -90,14 +90,20 @@ version of Powershell](https://winget.run/pkg/Microsoft/PowerShell), use mklink
9090
via `cmd /c mklink`, or use an elevated prompt. You can check your Powershell
9191
version with `$PSVersionTable.PSVersion`.
9292

93+
There also exist other types of links on Windows, like hardlinks and junctions,
94+
which don't require special privileges to create, but have more limitations:
95+
96+
* [Hardlinks](https://learn.microsoft.com/en-us/windows/win32/fileio/hard-links-and-junctions#hard-links) (`mklink /h`) can only be created for files and only on the same filesystem, among other limitations.
97+
* [Junctions](https://learn.microsoft.com/en-us/windows/win32/fileio/hard-links-and-junctions#junctions) (`mklink /j`) can only be created for directories and can't use relative paths, among other limitations.
98+
9399
## Known Issues
94100

95-
As stated above, for the deep-copy to work the target needs to exist for the
96-
symlinking to work. While dangling symlinks are not that common, they can happen
97-
easily when unpacking a tar file that contains symlinks. If the symlinks is
98-
unpacked before the target, then creating the symlink will fail. A workaround
99-
for this is to unpack the tar file twice, first to create the target while
100-
ignoring any symlink creation errors and then to create the symlinks:
101+
For the default `winsymlinks:deepcopy` mode in MSYS2 the target needs to exist
102+
for the symlinking to work. While dangling symlinks are not that common, they
103+
can happen easily when unpacking a tar file that contains symlinks. If the
104+
symlinks is unpacked before the target, then creating the symlink will fail. A
105+
workaround for this is to unpack the tar file twice, first to create the target
106+
while ignoring any symlink creation errors and then to create the symlinks:
101107

102108
```bash
103109
bsdtar -xf "archive.tar.bz2" 2>/dev/null || bsdtar -xf "archive.tar.bz2"

0 commit comments

Comments
 (0)