-
Notifications
You must be signed in to change notification settings - Fork 787
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
Using lfs_dir_tell at the end of a directory succeds, but then lfs_dir_seek fails #785
Labels
needs investigation
no idea what is wrong
Comments
This was referenced Mar 13, 2023
Hi @sosthene-nitrokey, thanks for creating an issue. I agree with your evaluation. Out of curiosity I tested telldir/seekdir locally on Linux and it returns a NULL dirent without error. It makes sense as this matches the behavior of file tell/seek when at the end of a file. I created #805 to fix this, let me know if you see any issues with it. |
Fixed by #805, included in 2.6.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Behaviour
When iterating over a directory with
lfs_dir_open
andlfs_dir_read
in a loop, if after callinglfs_dir_read
on the last file, one callslfs_dir_tell
, the call success. However, callinglfs_dir_seek
with the given value fails with-22
(invalid).Expected behaviour
I'd expect this to succeed and only further calls to
lfs_dir_read
to fail. It would also be reasonable to havelfs_dir_tell
fail too with aNOENT
error..Reproducer
The
test_dirs
doesn't iterate over all the files created in the directory, so this bug doesn't happen in the test suite. See #786 for an updated test suite that triggers the bug.The text was updated successfully, but these errors were encountered: