Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileSystemItem.from_path() ignores link_target=False parameter #462

Closed
mih opened this issue Oct 3, 2023 · 0 comments · Fixed by #464
Closed

FileSystemItem.from_path() ignores link_target=False parameter #462

mih opened this issue Oct 3, 2023 · 0 comments · Fixed by #464

Comments

@mih
Copy link
Member

mih commented Oct 3, 2023

It will call readlink unconditionally for any symlink.

The following patch should fix it. A corresponding test is TODO.

diff --git a/datalad_next/iter_collections/utils.py b/datalad_next/iter_collections/utils.py
index 0f00a2e..91fcdc4 100644
--- a/datalad_next/iter_collections/utils.py
+++ b/datalad_next/iter_collections/utils.py
@@ -96,7 +96,7 @@ class FileSystemItem(PathBasedItem, TypedItem):
             uid=cstat.st_uid,
             gid=cstat.st_gid,
         )
-        if ctype == FileSystemItemType.symlink:
+        if link_target and ctype == FileSystemItemType.symlink:
             # could be p.readlink() from PY3.9+
             item.link_target = PurePath(os.readlink(path))
         return item
mih added a commit to mih/datalad-next that referenced this issue Oct 3, 2023
mih added a commit to mih/datalad-next that referenced this issue Oct 3, 2023
mih added a commit to mih/datalad-next that referenced this issue Oct 3, 2023
@mih mih closed this as completed in #464 Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant