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

Fix empty reads #6

Merged
merged 1 commit into from
Aug 30, 2023
Merged

Fix empty reads #6

merged 1 commit into from
Aug 30, 2023

Conversation

sapfeer0k
Copy link

Fist of all , I believe this is a very much needed tool for developers and I would be happy to see this released as a docker plugin :)

I tried to play with it but stuck with an error. All my attempts to read content of the file were failing. I am using go 1.18.1 and it turns out File.ReadAt function always return EOF error if data read from the file is less than the allocated buffer size (docs https://go.dev/src/os/file.go?s=7686:7723)

I had to tweak error handler to let the data be returned in that special case

@dguerri
Copy link
Owner

dguerri commented Aug 29, 2023

@sapfeer0k, thanks! Good catch and investigation!

The EOF error is handled here in the client so effectively you are getting no data.

I think you are doing the right thing by "ignoring" the EOF error and returning what's in the buffer, as the read() in the go-fuse client, can't have the same behaviour as readAt()

It would be great to have a unit test to prevent regressions :)

Copy link
Owner

@dguerri dguerri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Owner

@dguerri dguerri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you feel like, please add a unit test.
If not I will add it later.

@dguerri dguerri merged commit a8da9a8 into dguerri:main Aug 30, 2023
5 checks passed
@sapfeer0k
Copy link
Author

Hi, sure, I will try to add a unit test for this specific case, although go is not my native language.

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.

3 participants