Re: [PATCH] VFAT fixes.

Alexander Viro (viro@math.psu.edu)
Fri, 15 Jan 1999 02:18:21 -0500 (EST)


On Fri, 15 Jan 1999, Albert D. Cahalan wrote:

>
> Alexander Viro writes:
>
> > * Due to the way longname->shortname conversion was implemented
> > attempt to create a file or directory called ".\xf6" (any
> > skippable symbols + 0xe5 or 0xf6 + anything else) resulted in
> > directory entry used by active inode, but free from the
> > msdos/vfat point of view ("\xf6" in this case). Fixed.
>
>
> I think you added a bug here, or at least made the short names less
> compatible with DOS.
>
>
> - if (c < ' ' || c == ':' || c == '\\') return -EINVAL;
> - if ((walk == name) && (c == 0xE5)) c = 0x05;
> + if (c < ' '|| c==':') return -EINVAL;
>
>
> If you do the above, DOS won't see files starting with 0xE5 correctly.
> DOS translates 0xE5 to 0x05 for the first character of a filename.
> DOS also translates back as needed. Only the first character changes.

Albert, look around that place. You will see that c is *not* checked for
0xe5 anywhere below. So it doesn't *introduce* a bug. But yes, it was (and
remained) there. Notice IS_FREE several lines above.

>
>
> - if (baselen == 3) {
> - for (reserved = reserved3_names; *reserved; reserved++)
> - if (!strnicmp(name,*reserved,baselen)) return -EINVAL;
> - } else if (baselen == 4) {
> - for (reserved = reserved4_names; *reserved; reserved++)
> - if (!strnicmp(name,*reserved,baselen)) return -EINVAL;
>
>
> Hopefully reserved names are handled elsewhere.

Yes, they are. vfat_valid_longname() is called before that stuff
now.
> + /* Yes, it can happen. ".\xe5" would do it. */
> + if (IS_FREE(base))
> + base[0]='_';
>
>
> base[0] ought to become 0x05, not '_'

OK, accepted. What would you propose for 0xf6? It's also covered
by IS_FREE stuff.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/