Giter Site home page Giter Site logo

OpenBSD: Readdir oddity about cgofuse HOT 4 OPEN

winfsp avatar winfsp commented on May 18, 2024
OpenBSD: Readdir oddity

from cgofuse.

Comments (4)

billziss-gh avatar billziss-gh commented on May 18, 2024

I've come across an oddity with Readdir which I'm not sure of the cause - I think it may be an OpenBSD bug but it might be a cgofuse bug so I thought I'd ask you first.

Yes, this looks odd.

This causes a problem for rclone since it checks to see that Readdir is never called with a non-zero offset which it never should be as it always passes 0 as an offset to the fill function. This is easy enough to work-around but I thought I'd report it in case it is indicative of an underlying problem.

I agree that you should not see a non-0 offset in Readdir, if you never pass a non-0 offset to the fill function.

In the Linux/FreeBSD/macOS case it is actually libfuse that makes this guarantee: the kernel protocol always includes the offset in the FUSE_READDIR request message, but libfuse abstracts this detail away by buffering readdir data, when it sees a 0 offset and satisfying the FUSE_READDIR request from the buffered data when it sees a non-0 offset. (Libfuse only does this buffering when you specify 0 offsets in the fill function.) See the libfuse fuse_readdir_common.

The cgofuse Readdir implementation is minimal and the same across all cgo platforms. So I suspect (but may be wrong) that in this case the problem lies with OpenBSD's implementation. I note that OpenBSD does not use libfuse.

from cgofuse.

billziss-gh avatar billziss-gh commented on May 18, 2024

Here is the readdir implementation of OpenBSD's libfuse, which appears to pass the kernel's view of the offset:

ifuse_ops_readdir

It appears to me that this is a problem with OpenBSD.

from cgofuse.

ncw avatar ncw commented on May 18, 2024

Thank you for your analysis Bill.

I finally found the docs for the fill behaviour in the libfuse docs

So what it looks like is that OpenBSD libfuse equivalent doesn't implement this behavior

  1. The readdir implementation ignores the offset parameter, and passes zero to the filler function's offset. The filler function will not return '1' (unless an error happens), so the whole directory is read in a single readdir operation.

@SylvestreG - I think you wrote this code originally. Does that sound right to you?

@lkostal - as the most recent OpenBSD user to be interested in this, do you want to report this as a bug?

from cgofuse.

djdv avatar djdv commented on May 18, 2024

Just wanted to corroborate that I'm experiencing this as well.
I took some notes during testing an implementation. Noticed an oddity when using NetBSD and OpenBSD.
https://gist.github.com/djdv/8341762e571ef799cf7613f2f3c1f506#netbsd
This lists some of the various versions I tried and has a small trace.

from cgofuse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.