-
Notifications
You must be signed in to change notification settings - Fork 3k
fs: Fix fstat retarget for regular files #5203
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
Conversation
GCC's newlib library depends on fstat to get in-flight information about a file's type an size. A working fstat for regular files is needed for seek and related functions to work correctly.
cc @kjbracey-arm |
platform/mbed_retarget.cpp
Outdated
return -1; | ||
} | ||
|
||
st->st_mode = S_IFREG; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also indicate S_IFCHR if FileHandle::isatty()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, should be updated
4638bca
to
0132691
Compare
/morph test-nightly |
Result: FAILUREYour command has finished executing! Here's what you wrote!
OutputTest failed! |
/morph test-nightly |
Result: FAILUREYour command has finished executing! Here's what you wrote!
OutputTest failed! |
The latest failure was not caused by this patch, master had to be patched, should be all good now /morph test-nightly |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
GCC's newlib library depends on fstat to get in-flight information about a file's type an size. A working fstat for regular files is needed for seek and related functions to work correctly.
Side note about testing this and #5183, I have tests inbound, which is what's finding these bugs. They're currently targeting littlefs here, but I will also bring them over the FAT filesystem once they're up and running.