Skip to content

[NSKIP026] FAT VFS returns wrong errno for path-edge cases #506

@ada-x64

Description

@ada-x64

[NSKIP026] FAT VFS returns wrong errno for path-edge cases

Skip message

NSKIP026: FAT VFS returns wrong errno for path-edge cases

Root cause

The FAT VFS error mapping diverges from POSIX for several path edge
cases. Documented variants:

  • mkdir('/') returns ENOENT instead of EEXIST
  • mkdir(over_existing_file) returns EINVAL instead of EEXIST
  • mkdir(path_under_a_file) returns EINVAL instead of ENOTDIR
  • scandir('') returns EINVAL instead of FileNotFoundError
  • shutil.copyfile(src, nonexistent_dst_dir/x) does not raise
    FileNotFoundError

CPython tests that assert on the specific errno class are skipped on
hosted Nanvix.

Inline repro

import os, errno
try:
    os.mkdir('/')
except OSError as e:
    print(e.errno, errno.errorcode.get(e.errno))   # ENOENT not EEXIST

open('/tmp/m_file', 'wb').write(b'x')
try:
    os.mkdir('/tmp/m_file')
except OSError as e:
    print(e.errno, errno.errorcode.get(e.errno))   # EINVAL not EEXIST

Finding the footprint

rg -n 'NSKIP026'

Parent

Tracked in #371.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions