incorrect(?) errno value in msdosfs

pluknet pluknet at gmail.com
Tue Feb 6 06:50:03 UTC 2007


hello.

I have discovered an unexpected behavior. If I perform a search
operation in the directory for non-existing files, then I get
the EINVAL value on msdosfs filesystem instead of
the ENOENT value returned. Actually I don't know what is
the right value should be returned and thus maybe I'm wrong
and I'm sorry for annoying. But It simply differs from the value
normally returned on ufs2 filesystem. So I decide to write here. :)
It is observed on 6.2 and CURRENT.

For example if I run the next command on msdosfs filesystem,
this is what I get:

bash-2.05b$ ls /mnt/msdosfs/*.nonexistent
ls: /mnt/msdosfs/*.nonexistent: Invalid argument

instead of:

bash-2.05b$ ls /mnt/msdosfs/*.nonexistent
ls: /mnt/msdosfs/*.nonexistent: No such file or directory

This behavior is fixed with the next workaround in v1.47,
but I guess that perhaps it needs to fix in some another place.
bash-2.05b$ diff -u -p msdosfs_lookup.c.orig msdosfs_lookup.c
--- msdosfs_lookup.c.orig       Tue Feb  6 08:56:43 2007
+++ msdosfs_lookup.c    Tue Feb  6 08:59:42 2007
@@ -147,7 +147,7 @@ msdosfs_lookup(ap)
        switch (unix2dosfn((const u_char *)cnp->cn_nameptr, dosfilename,
            cnp->cn_namelen, 0, pmp)) {
        case 0:
-               return (EINVAL);
+               return (ENOENT);
        case 1:
                break;
        case 2:

wbr,
pluknet


More information about the freebsd-current mailing list