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

DAG reader: seeking to the end of the file leaves the offset at zero #5255

Closed
schomatis opened this issue Jul 18, 2018 · 4 comments
Closed
Assignees
Labels
kind/bug A bug in existing code (including security flaws) topic/UnixFS Topic UnixFS

Comments

@schomatis
Copy link
Contributor

Seeking to an offset equal to the size of the file (or a bigger) leaves the linkPosition (unmodified) at the start of the file (where subsequent read operations will pick up from).

https://github.com/ipfs/go-ipfs/blob/9bad5fe6fef11fc5d923e7ebecbe6f53deb044fe/unixfs/io/pbdagreader.go#L275-L286

I'm working on some modifications to the DAG reader and I'm not sure if this is a bug or it is an intended behavior (I don't know what happens in the Unix API when doing something like this) as some of the current tests (like TestLargeWriteChunks) depend on it.

@schomatis schomatis added this to the Files API Documentation milestone Jul 18, 2018
@schomatis schomatis self-assigned this Jul 18, 2018
@schomatis
Copy link
Contributor Author

/cc @Stebalien

@Stebalien
Copy link
Member

This should follow POSIX and seek past the end of the file. Reading should return zero bytes and an EOF.

@schomatis
Copy link
Contributor Author

Ok, this is a bug then, thanks.

@schomatis
Copy link
Contributor Author

Fixed in ipfs/go-unixfs#60.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) topic/UnixFS Topic UnixFS
Projects
None yet
Development

No branches or pull requests

2 participants