Closed jaraco closed 8 years ago
Original comment by Waldemar Kornewald (Bitbucket: wkornewald, GitHub: wkornewald):
Oh I just noticed that you left the target path normalization in the code. In that case, I guess it's fine to remove the link name normalization if that's already handled by the rest of the code.
So, only the isabs check is necessary.
Original comment by Waldemar Kornewald (Bitbucket: wkornewald, GitHub: wkornewald):
The isabs check is necessary because only relative paths are relative to the link's folder. Absolute paths are already absolute and can be passed to isdir() directly.
The normalization is more consistent because the other os.path commands work correctly on Windows even when there's a "/" in the path, so symlink should convert "/" to "\" on Windows, too.
Original comment by Jason R. Coombs (Bitbucket: jaraco, GitHub: jaraco):
Fixed in <<changeset 8adaddc5c801>>. Thanks for the patch.
In <<changeset 304ef3016729>>, I removed the use of isabs
, because I don't think it's necessary, and also the normalization of link
. Please review and let me know if those calls serve a purpose I didn't recognize.
Originally reported by: Waldemar Kornewald (Bitbucket: wkornewald, GitHub: wkornewald)
The symlink() function doesn't correctly detect whether the target is a directory if the link is relative and placed outside of the current working directory. Also, readlink() always converts the link target to an absolute path which isn't correct when dealing with relative links. The attached patch fixes both problems.