You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
Debugging the test failures for #67073 on Windows, I discovered three issues related to Windows symlink handling.
Note that I don't have a Windows minion to give proper replication instructions.
Symlinks with relative targets pointing to directories create somewhat broken symlinks. This is caused by Windows (file systems?) discriminating between symlinks pointing to files and those that point to directories. The corresponding handling expects symlink targets to be specified in an absolute manner (or relative to the process' CWD, which is unintended for sure) and to exist:
Symlinks created in this way raised PermissionErrors during specific assertions that called .stat() on the associated pathlib.Path, such as .exists() and .is_dir():
Test runner output:
[...]assert (base / "symlink_target_dir_overridden_by_dir").is_dir()[...]artifacts\salt\lib\pathlib.py:1305: in is_dir return S_ISDIR(self.stat().st_mode) self = WindowsPath('D:/a/_temp/pytest-of-runneradmin/pytest-1/test_recurse_merge_True_True_0/target/symlink_target_dir_overridden_by_dir')[...]self = WindowsPath('D:/a/_temp/pytest-of-runneradmin/pytest-1/test_recurse_merge_True_True_0/target/symlink_target_dir_overridden_by_dir') def stat(self, *, follow_symlinks=True): """ Return the result of the stat() system call on this path, like os.stat() does. """
> return self._accessor.stat(self, follow_symlinks=follow_symlinks)E PermissionError: [WinError 5] Access is denied: 'D:\\a\\_temp\\pytest-of-runneradmin\\pytest-1\\test_recurse_merge_True_True_0\\target\\symlink_target_dir_overridden_by_dir'
Paths below this broken symlink still work correctly though.
Similar behavior as in 1) was likely observed with file.recurse and keep_symlinks=True since the symlinks were created before the directories they pointed to (on top of relative symlinks always being broken).
The roots fileserver module fails to transform symlink target paths to POSIX style paths when listing symlinks on Windows, which makes its output depend on the master's OS and thus symlink target handling unreliable.
(Not completely sure how to do this on Windows via CLI, sorry!)
Setup
This came up in CI (based on current master branch) for Windows 2022 Server runners.
Steps to Reproduce the behavior
See above.
Expected behavior
1+2) Produce a directory symlink that works.
3) Always return POSIX style paths, otherwise the output cannot be used programmatically.
Screenshots
See above.
Versions Report
current master branch (commit 1cd6139)
The text was updated successfully, but these errors were encountered:
Description
Debugging the test failures for #67073 on Windows, I discovered three issues related to Windows symlink handling.
Note that I don't have a Windows minion to give proper replication instructions.
salt/salt/modules/win_file.py
Line 1464 in 4c1b423
Rough reproduction:
Symlinks created in this way raised PermissionErrors during specific assertions that called
.stat()
on the associatedpathlib.Path
, such as.exists()
and.is_dir()
:Test runner output:
Paths below this broken symlink still work correctly though.
Similar behavior as in 1) was likely observed with
file.recurse
andkeep_symlinks=True
since the symlinks were created before the directories they pointed to (on top of relative symlinks always being broken).The
roots
fileserver module fails to transform symlink target paths to POSIX style paths when listing symlinks on Windows, which makes its output depend on the master's OS and thus symlink target handling unreliable.(Not completely sure how to do this on Windows via CLI, sorry!)
$ salt-run fileserver.clear_file_list_cache $ salt-run fileserver.update $ salt-call cp.list_master_symlinks local: ---------- testdir/symlink: subdir\file
Setup
This came up in CI (based on current master branch) for Windows 2022 Server runners.
Steps to Reproduce the behavior
See above.
Expected behavior
1+2) Produce a directory symlink that works.
3) Always return POSIX style paths, otherwise the output cannot be used programmatically.
Screenshots
See above.
Versions Report
current master branch (commit 1cd6139)
The text was updated successfully, but these errors were encountered: