Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Aug 2024 17:44:18 +0000
From:      bugzilla-noreply@freebsd.org
To:        fs@FreeBSD.org
Subject:   [Bug 281033] [msdosfs] rm -f fails
Message-ID:  <bug-281033-3630-XdL7MgE2AU@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-281033-3630@https.bugs.freebsd.org/bugzilla/>
References:  <bug-281033-3630@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D281033

Stefan E=C3=9Fer <se@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |se@FreeBSD.org
           Assignee|fs@FreeBSD.org              |se@FreeBSD.org
             Status|New                         |Open

--- Comment #1 from Stefan E=C3=9Fer <se@FreeBSD.org> ---
The patch that has been discussed as GitHub pull request 1329
(https://github.com/freebsd/freebsd-src/pull/1329) will be attached to this=
 PR.

It has an undesirable side effect: the mv command returns "No such file or
directory" instead of "Invalid argument" when the target file name is inval=
id:

# touch /boot/efi/A.DAT
# mv /boot/efi/A.DAT /boot/efi/B*.DAT
mv: rename /boot/efi/A.DAT to /boot/efi/B*.DAT: No such file or directory

This is caused by namei() being called with the target filename and that
invokes the patched msdosfs_lookup() and thus gets and returns the changed
error code.

But since the patch affects namei() and functions that call it, more vnode
operations will return ENOENT instead of ```EINVAL`` with this patch (when
given an invalid MSDOS file name on an MSDOSFS file system).

The rename(2) man page mentions both EINVAL and ENOENT, but neither descrip=
tion
mentions the case of an invalid target file name:

[ENOENT] A component of the from path does not exist, or a path prefix of to
does not exist.

[EINVAL] The from argument is a parent directory of to, or an attempt is ma=
de
to rename =E2=80=98.=E2=80=99 or =E2=80=98..=E2=80=99.

Maybe the case of a target name not allowed on some file system should be
added, e.g. one of:

[EINVAL] The from argument is a parent directory of to, or an attempt is ma=
de
to rename =E2=80=98.=E2=80=99 or =E2=80=98..=E2=80=99, or the target filena=
me is invalid.

[ENOENT] A component of the from path does not exist, a path prefix of to d=
oes
not exist, or the target filename is invalid.

If changing the return code of rename() (and possibly other system calls th=
at
return the error code of a failed namei() call unmodiified) is acceptable f=
or
this specific error case, I'll commit the patch to -CURRENT, but I'm not su=
re
whether POLA will allow merging to -STABLE.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-281033-3630-XdL7MgE2AU>