← index #2929PR #6467
Related · medium · value 3.127
QUERY · ISSUE

VFS FatFS: mkdir with trailing slash fails when it should succeed

openby dpgeorgeopened 2017-03-03updated 2017-03-08

On CPython and unix uPy, os.mkdir('directory/') makes the requested directory. But on bare metal ports using VFS with FatFS it fails with ENOENT because of the trailing slash. I'd say this should be fixed. (And in fact CPy and unix uPy allow any number of trailing slashes).

CANDIDATE · PULL REQUEST

extmod/vfs: Fix lookup of entry in root dir so it fails correctly.

mergedby dpgeorgeopened 2020-09-22updated 2020-09-23
extmod

Prior to this commit, uos.chdir('/') followed by uos.stat('noexist') would succeed that stat even though the entry did not exist (some other functions like listdir would have similar issues). This is because, if the current directory was the root and the path was relative, mp_vfs_lookup_path would return success for bad paths.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied