nuttx/fs/fat
Gregory Nutt 97b0235d77 s/dirent: Corrects a problem with opendir() noted by Petteri Aimonen in Bitbucket Issue 132: "opendir() fails for FAT filesystem with trailing slash in path":
I see the following behaviour on NuttX 7.26, where I have SD card mounted on /flash and a directory called "frm" on it:

opendir("/flash")  returns  (DIR *) 0x1000c580
opendir("/flash/") returns (DIR *) 0x1000c5d0
opendir("/flash/frm")  returns (DIR *) 0x1000c620
opendir("/flash/frm/")  returns (DIR *) 0x0

From POSIX specs for opendir(): "A pathname ... that ends with one or more trailing slashes shall be resolved as if a single dot character ( '.' ) were appended to the pathname."

So for mount points, opendir() works correctly, but for FAT32 filesystem it fails to open directory if the path has a trailing slash. I'm not quite sure how to cleanly fix this. Stripping the trailing slash in opendir() would require allocating a separate buffer, while fixing it in the FAT32 code seems somewhat complex due to the short/long filename logic.

It is not a big issue for me, I'm just going to fix it on the application side. But still a small portability and standards compliance issue.

NOTE: You would not see this problem if you call opendir() indirectly in NSH (like 'ls -R /') because NSH contains logic to remove trailing '/' characters from paths.
2018-11-16 11:45:18 -06:00
..
fs_fat32.c s/dirent: Corrects a problem with opendir() noted by Petteri Aimonen in Bitbucket Issue 132: "opendir() fails for FAT filesystem with trailing slash in path": 2018-11-16 11:45:18 -06:00
fs_fat32.h Trivial FATFS cleanup 2018-07-22 08:42:15 -06:00
fs_fat32attrib.c Add macros support that will eventually allow dynamic allocation of strings need to support soft links. 2017-02-05 14:25:45 -06:00
fs_fat32dirent.c Updates based on coding style review of PR 755 2018-11-09 07:51:43 -06:00
fs_fat32util.c Merged in paimonen/nuttx/pullreq_FAT_improvements (pull request #755) 2018-11-09 13:46:16 +00:00
Kconfig Merged in paimonen/nuttx/pullreq_FAT_improvements (pull request #755) 2018-11-09 13:46:16 +00:00
Make.defs Squashed commit of the following: 2017-10-20 12:36:25 -06:00