-
Notifications
You must be signed in to change notification settings - Fork 2.1k
File systems report names with leading slashes #14635
Description
Description
Several file systems (at least constfs and littlefs) return file names with leading slashes.
Steps to reproduce the issue
In the filesystems example with the default littlefs backend for sda:
> ls /const
/hello-world
/hello-riot
total 2 files
> format
> mount
> tee /sda/foo hello
> ls /sda
/.
/..
/foo
total 3 files
In contrast, fatfs (with an externally created image) gives slash-free names:
> ls /sda
FOO
EMPTY
FOLDER
GARBAGE
total 4 files
Expected results
The vfs_dirent_t struct describes a field for "file name, relative to its containing directory".
That indicates that it can only be a file name, ie. a string that contains any characters except '\0' and '/'. It may also help to have some explicit statement in here.
Context
This was found in #14397, which (working as a file server with URIs) has stricter requirements on the precision of names.
As this affects at least two file systems, this should be tracked in separate bugs for:
- littlefs (closed in pkg/littlefs*: align readdir() with documentation #17623 )
- constfs (closed in fs/constfs: omit leading '/' in readdir() #17626)
I can create and look into those in particular, but a statement from someone more familiar with the design of the file systems calls would be useful (thus the "help" tag, feel free to remove that with a clarifying remark).
Versions
current RIOT master (6ef4276) on native