Subject: Most definite bug in msdosfs
To: None <current-users@NetBSD.ORG>
From: John F. Woods <>
List: current-users
Date: 08/30/1995 14:45:22
OK, I looked a little harder.
Attempting to chmod() a directory, ANY directory, on an msdosfs filesystem
results in the name of the at directory being written over its "." entry.
Why?  The routine deget(), which is the vget() equivalent for "denodes",
labels each denode with the location in its parent directory where its name
and attributes are stored.  (uh oh, no "remove the file while it's open" for
us!)  Unless, of course, the denode is a directory, in which case its canonical location is its own "." address.  Unfortunately, de_updat() (which eventually
gets called when a denode is marked as requiring updating, like when you've
potentially changed its flags) assumes that the canonical location is always the
name entry -- or at least DE_EXTERNALIZE assumes this, which copies the
internal data structure (including name) into the on-disk version, thus
neatly overwriting the "." entry with the actual name of the directory.

I'll send-pr this tonight when I have more details (I'm telnetted to my
home machine now, and the link is currently painfully slow).  With luck
I'll even discover a reasonable fix.

In the meantime, does anyone have either source for an fsck equivalent for
MSDOS filesystems, or a free compaction program for MSDOS filesystems
(even an MSDROSS executable for the latter)?  Or how about a good reference for
the layout of the MSDOS "filesystem"?  Bleah bleah BLEAH!