[issue37612] os.link(..., follow_symlinks=True) broken on Linux

Eryk Sun report at bugs.python.org
Thu Jul 18 07:18:03 EDT 2019


Eryk Sun <eryksun at gmail.com> added the comment:

> on Windows (where there is no linkat()) os.link() creates a new link
> to the symbolic link itself. 

Yes, CreateHardLinkW opens the source file by calling NtOpenFile with the option FILE_OPEN_REPARSE_POINT. So the behavior is follow_symlinks=False. 

Note, however, that Windows has distinct file and directory reparse points, so we can't hardlink to a directory symlink, or any other type of directory reparse point such as a junction mountpoint. In Unix, follow_symlinks=False (if implemented) allows creating a hardlink to a symlink that targets a directory.

Also, I noticed that I can pass follow_symlinks=False in Windows, but this should raise NotImplementedError. It's supposed to be checked via follow_symlinks_specified().

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37612>
_______________________________________


More information about the Python-bugs-list mailing list