Skip to content

File systems report names with leading slashes #14635

@chrysn

Description

@chrysn

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: fsArea: File systemsCommunity: help wantedThe contributors require help from other members of the communityType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)Type: trackingThe issue tracks and organizes the sub-tasks of a larger effort

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions