mirror of
https://github.com/rclone/rclone.git
synced 2026-06-09 17:04:38 -04:00
With cmd/mount2, reading a directory more than once returned the correct entries on the first read but nothing on subsequent reads. Plain `ls` triggers this: it does lseek(fd, 0, SEEK_SET) to rewind the directory before a second getdents. go-fuse v2.9.0 rewinds a directory stream by calling Seekdir on the FileSeekdirer interface. dirStream did not implement it, so go-fuse returned ENOTSUP and produced an empty listing on every read after the first. This implements Seekdir on dirStream: a rewind to offset 0 resets the stream to the start, restoring correct listings on re-read. Non-zero offsets are uncommon for in-memory listings and still return ENOTSUP, matching go-fuse's own default. A compile-time interface assertion is added so signature drift on future go-fuse updates is caught at build time. Before: second and subsequent reads of a directory returned no entries. After: directories list correctly on every read. See: https://github.com/hanwen/go-fuse/issues/549 Co-authored-by: Nick Craig-Wood <nick@craig-wood.com>