Bug 7907 - unlink of illegal name should not return EINVAL
unlink of illegal name should not return EINVAL
Status: NEW
Product: CifsVFS
Classification: Unclassified
Component: kernel fs
Other Linux
: P3 normal
: ---
Assigned To: Steve French
Depends on:
  Show dependency treegraph
Reported: 2011-01-11 15:18 UTC by Nadav Har'El
Modified: 2011-01-11 15:27 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Nadav Har'El 2011-01-11 15:18:57 UTC
It appears that unlink()ing a filename with illegal characters (such as "*") returns EINVAL. This is odd, because it could have just returned ENOENT (just like deleting any other nonexistant file), or, if you follow the next POSIX standard, EILSEQ.

The manifistation of this issue is that if you do

   rm -f "*"

with the current coreutils, rm -f doesn't ignore this error, because it only ignores ENOENT, not EINVAL. I noticed this when a Linux kernel makefile broke (with the files on a Windows machine mounted with cifs), because "rm -f .tmp-versions/*" failed when the directory was empty, and the failure was not ignored.

This will be fixed in the next version of rm (it will ignore both EINVAL and EILSEQ), but it anyway brings up a question why smbfs/cifsfs needs to return EINVAL at all. EINVAL is nowhere to be mentioned in the unlink(2) documentation, by the way.
Comment 1 Eric Blake 2011-01-11 15:27:52 UTC
For clarification - here's the wording that will be in the next POSIX revision that adds the requirement for EILSEQ on unsupported file names: