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 a file does not exist, checking for file existence returns false as expected. However, if I enable debugging it also triggers an unexpected DBG_FAIL before returning:
DBG_FAIL: FatFileLFN.cpp 418
the relevant code is:
create:
// don't create unless O_CREAT and write mode
if (!(oflag & O_CREAT) || !isWriteMode(oflag)) {
DBG_FAIL_MACRO;
goto fail;
}
Although everything works fine with debugging turned off, this still seems like a possible bug because I can't see any reason why the code should be attempting to create a file when I am testing for file existence.
I never intended for debug to be use for finding bugs in applications. It is intended to find bugs in the library. I try to place a debug macro everywhere a fail is returned and exists will return false.
The problem is that open will fail if you attempt to open a file that does not exist for read or write without O_CREATE.
There are many other quirks if you use debug to find bugs in applications.
Yes, I was looking for bugs in the library because some of the results were not as expected. However, it turned out that the results were as I should have expected, had I understood the library better.
It just seemed odd that the library fires a debug_fail on the expected outcome of a function (testing for file existence returns false when the file is not present). It made me scrutinize the library code when in fact it was performing as designed.
when a file does not exist, checking for file existence returns false as expected. However, if I enable debugging it also triggers an unexpected DBG_FAIL before returning:
DBG_FAIL: FatFileLFN.cpp 418
the relevant code is:
Although everything works fine with debugging turned off, this still seems like a possible bug because I can't see any reason why the code should be attempting to create a file when I am testing for file existence.
The initial call goes to FsFile.h at line 98:
This is a Fat32 card, so the first branch is taken to FatFile.h at 258:
This leads to FatFile.cpp at 412:
Which leads finally to FatFileLFN.cpp at 302, with the DBG_FAIL occurring at line 418 at bottom:
The text was updated successfully, but these errors were encountered: