RE: 2.0.3[01]: reproducable vfat fs corruption

Jean-Claude (jclaude@mandalux.com)
Sun, 26 Oct 1997 10:30:36 +0100 (MET)


Le 22-Oct-97 Florian Weimer a écrit:

>-L parameter. As a result, all the filenames were uppercase.
>So I
>used the `ired mode of XEmacs 20.2 to convert them to lower
>case.
>Unfortunately, the files were located on a vfat filesystem,
>revealing
>a bug in the corresponding Linux code: the first file which was
>renamed disappeared completely, the others were truncated after

It's not a Linux VFAT bug, but a MS VFat undocumented feature :-)
VFat files are case insensitive. The only place where you can
find TheCaseMapper is in the wrapper around the real file name.

So Linux is true when it says origin and dest are the same. If
you insist, the Dos VFat wrapper gets confused and happily
crashes the file system.

If you tried the same operation through OS/2, you get the same
behavior.

>This behaviour is completely reproducable on my machine.
>Because the
>`mv' command tests via lstat(2) wether the source and
>destination
>filenames refer to the same file, you have to use the rename(2)
>system
>call directly, using a program like this (sorry, no perl script
>;-):
>
>----------------------------------------------------------------
>------
>#include <stdio.h>
>#include <stdlib.h>
>
>int main(int argc, char ** argv)
>{
> if (argc != 3) {
> fprintf(stderr, "usage: %s src dest\n", argv[0]);
> return EXIT_FAILURE;
> }
> if (rename(argv[1], argv[2])) {
> perror(argv[0]);
> return EXIT_FAILURE;
> }
> return EXIT_SUCCESS;
>}
>----------------------------------------------------------------
>------
>

Even this cannot work... you'll go on crashing the poorly
constructed VFat architecture.
The real bug is in the fake case sensitivity in the Microsoft
code.

Jean-Claude

---
Jean-Claude Richard                        email: jclaude@mandalux.com
Mandala Conseil                                     admin@mandalux.com
29 Rue Lambert                                 http://www.mandalux.com
F75018 - Paris - France