[Bug 281033] [msdosfs] rm -f fails
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 24 Aug 2024 17:44:18 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281033 Stefan Eßer <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ßer <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 invalid: # 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 description 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 made to rename ‘.’ or ‘..’. 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 made to rename ‘.’ or ‘..’, or the target filename is invalid. [ENOENT] A component of the from path does not exist, a path prefix of to does not exist, or the target filename is invalid. If changing the return code of rename() (and possibly other system calls that return the error code of a failed namei() call unmodiified) is acceptable for this specific error case, I'll commit the patch to -CURRENT, but I'm not sure whether POLA will allow merging to -STABLE. -- You are receiving this mail because: You are the assignee for the bug.