Skip to content

feat: support symlink detection when reading directories - #8554

Merged
ncw merged 1 commit into
rclone:masterfrom
huangnauh:master
Aug 17, 2025
Merged

ncw merged 1 commit into
rclone:masterfrom
huangnauh:master

Conversation

@huangnauh

@huangnauh huangnauh commented May 13, 2025 •

Copy link
Copy Markdown
Contributor

What is the purpose of this change?

Was the change discussed in an issue or in the forum before?

Checklist

  • I have read the contribution guidelines.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • I'm done, this Pull Request is ready for review :-)

@Neustradamus

Copy link
Copy Markdown

@ncw: Have you seen this PR?

@ncw

ncw commented Aug 15, 2025

Copy link
Copy Markdown
Member

@huangnauh @Neustradamus sorry missed this one.

Can either of you explain what it fixes please? So when using rclone mount with XXX flags, I do XXX and I see YYY but I was expecting ZZZ? Thanks

@darthShadow

Copy link
Copy Markdown
Member

I think when the changes were made for adding symlink support for the various mount commands, we missed setting proper flags in readdir results, specifically only for the mount command. It was added for cmount & mount2, but got missed in mount.

mount2 implementation: https://github.com/rclone/rclone/blob/master/cmd/mount2/node.go#L257
cmount implementation: https://github.com/rclone/rclone/blob/master/cmd/cmount/fs.go#L146

mount symlink changes: db1ed69

It missed the update for readdir results too.

@ncw

ncw commented Aug 16, 2025

Copy link
Copy Markdown
Member

@darthShadow I think the fix looks correct.

I'd just like to know what it breaks because in testing rclone mount with symlinks works fine.

@trapexit

Copy link
Copy Markdown

The problem is likely the difference between d_type being set in readdir and stat. At the very least d_type should be set to DT_UNKNOWN in Linux but d_type is not supported on all platforms and where it is software needs to handle DT_UNKNOWN. IE... they shouldn't assume readdir gives you the file type. Should be picked up from stat.

@ncw

ncw commented Aug 17, 2025

Copy link
Copy Markdown
Member

Thanks for your input @trapexit

I will merge this as it is correct. Just nosy as to what it broke!

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 this pull request may close these issues.

5 participants