Subject: kern/4285: msdosfs is broken
To: None <>
From: Dave Huang <>
List: netbsd-bugs
Date: 10/17/1997 21:47:01
>Number:         4285
>Category:       kern
>Synopsis:       msdosfs is broken
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 17 19:50:04 1997
>Originator:     Dave Huang
Name: Dave Huang     |   Mammal, mammal / their names are called /
INet:   |   they raise a paw / the bat, the cat /
FurryMUCK: Dahan     |   dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 21 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++
>Release:        NetBSD-current as of October 17, 1997
System: NetBSD 1.2G NetBSD 1.2G (SPIFF) #141: Fri Oct 17 17:27:17 CDT 1997 i386

msdosfs seems to be pretty messed up after the FAT32 changes :( ls -l
shows the files with bogus modification dates and file sizes. Reading
a file returns junk.
Mount a FAT16 filesystem somewhere, like /dos/c. If it matters, my fs
does have Win95 long filenames, and I mounted with the -l option.
Also, I'm loading msdosfs as an lkm.

ls -l /dos/c
cat /dos/c/autoexec.bat (or some other file)

After applying the patch below (which may not be correct), things are
a bit better, but still broken. ls -l shows the right dates and sizes,
and reading a file returns the right stuff. However, "touch
/dos/c/somefile.txt" creates a directory:
drwxrwxr-x  1 root  wheel  16384 Dec 31  1979 /dos/c/somefile.txt/

ls -l /dos/c/somefile.txt shows the contents of the FAT filesystem's
root directory. As does
ls -l /dos/c/somefile.txt/somefile.txt/somefile.txt/somefile.txt

I haven't done any more experiments for fear of totally hosing my
filesystem :)

I'm not sure... perhaps this is what was intended? It improves things
for me, at least:

--- /usr/src/sys/msdosfs/msdosfs_lookup.c	Fri Oct 17 13:40:59 1997
+++ msdosfs_lookup.c	Fri Oct 17 21:26:30 1997
@@ -442,7 +442,7 @@
-	if (cluster == MSDOSFSROOT) {
+	if (scn == MSDOSFSROOT) {
 		 * Force root to be a directory.