diff options
author | Tony Cook <tony@develop-help.com> | 2022-11-17 16:58:10 +1100 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2023-01-10 10:14:52 +1100 |
commit | 44ba6f934ac72e3683f845ec47484bf1edce6854 (patch) | |
tree | cf23092061968de4f36e13ed14f17458f17602ac /t/win32 | |
parent | c2ac50f0d8a302a8318dba200ad4f5e549d472f2 (diff) | |
download | perl-44ba6f934ac72e3683f845ec47484bf1edce6854.tar.gz |
on win32 translate / to \ in symlink targets
Windows, or at least NTFS, doesn't appear to follow symlinks
where the target contains the POSIX directory separator "/".
To fix that translate any / to \ in symlink targets. This may
break code that checks the symlink target macthes a value set,
but I think it's more likely to fix code that blindly uses /
than break code that looks at the symlink target they just set.
Fixes #20506
Diffstat (limited to 't/win32')
-rw-r--r-- | t/win32/symlink.t | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/t/win32/symlink.t b/t/win32/symlink.t index 96ed7a1b11..084712e9ca 100644 --- a/t/win32/symlink.t +++ b/t/win32/symlink.t @@ -74,10 +74,18 @@ close $fh if $fh; ok(symlink($tmpfile1, $tmpfile2), "link to it"); ok(-l $tmpfile2, "-l sees a link"); ok(!-f _, "-f on the lstat result is false"); -ok(-f $tmpfile2, "normal -d sees it as a file"); +ok(-f $tmpfile2, "normal -f sees it as a file"); is(readlink($tmpfile2), $tmpfile1, "readlink works"); check_stat($tmpfile1, $tmpfile2, "check file and link stat are the same"); ok(unlink($tmpfile2), "unlink the symlink"); + +# make a relative link +unlike($tmpfile1, qr([\\/]), "temp filename has no path"); +ok(symlink("./$tmpfile1", $tmpfile2), "UNIX (/) relative link to the file"); +ok(-f $tmpfile2, "we can see it through the link"); +system "dir"; +ok(unlink($tmpfile2), "unlink the symlink"); + ok(unlink($tmpfile1), "and the file"); # test we don't treat directory junctions like symlinks |