You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When iterating over a directory with lfs_dir_open and lfs_dir_read in a loop, if after calling lfs_dir_read on the last file, one calls lfs_dir_tell, the call success. However, calling lfs_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 have lfs_dir_tell fail too with a NOENT 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:
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.
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: