Re: VFAT: Can't create file named 'aux.h'?

From: Randy.Dunlap
Date: Mon Mar 20 2006 - 16:40:43 EST


On Mon, 20 Mar 2006 15:40:22 -0600 Dirk Reiners wrote:

>
> Hi everybody,
>
> while trying to back up a couple Linux directories to a FAT disk I ran
> into a weird situation: I can't create a file called aux.h on the FAT
> system!
>
> Here's how to reproduce it:
>
> cd /tmp
> dd if=/dev/zero of=vfat_img bs=1M count=1
> /sbin/losetup /dev/loop7 vfat_img
> /sbin/mkfs.vfat /dev/loop7
> mkdir vfat_mnt
> mount -t vfat /dev/loop7 vfat_mnt
> touch vfat_mnt/auy.h
> touch vfat_mnt/aux.h
>
> auy.h is happily created, aux.h gives "touch: setting times of
> `vfat_mnt/aux.h': No such file or directory", and no file is created.
> This happened to me on the system described below, but I could reproduce
> the same behavior on a system booted from RHEL4 CDs, an old Knoppix
> (3.4), and friends could reproduce it on other systems, too, so it
> doesn't seem to be very related to a specific version.
>
> As a workaround I tar/bzipped my dirs, but that behavior seems very
> unusual and doesn't inspire a lot of confidence in vfat... What am I
> missing here?

"AUX" is (was) a reserved "filename" in DOS. The Linux MS-DOS
filesystem preserves (protects) that. The extension part does not
matter; it only checks the first 8 characters of the filename.
You'll need to use a different filesystem or filename...


fs/msdos/namei.c:

for (reserved = reserved_names; *reserved; reserved++)
if (!strncmp(res, *reserved, 8))
return -EINVAL;

/* MS-DOS "device special files" */
static const unsigned char *reserved_names[] = {
"CON ", "PRN ", "NUL ", "AUX ",
"LPT1 ", "LPT2 ", "LPT3 ", "LPT4 ",
"COM1 ", "COM2 ", "COM3 ", "COM4 ",
NULL
};


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