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

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.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2020-09-22 15:05:00 +10:00
parent 3e16763201
commit 71adf506ce
3 changed files with 22 additions and 6 deletions

View File

@@ -1,6 +1,18 @@
(16384, 0, 0, 0, 0, 0, 0, 0, 0, 0)
True
/
chdir x OSError
chdir /x OSError
listdir x OSError
listdir /x OSError
mkdir x OSError
mkdir /x OSError
remove x OSError
remove /x OSError
rmdir x OSError
rmdir /x OSError
stat x OSError
stat /x OSError
1 mount False False
['test_mnt']
('test_mnt', 16384, 0)