Subject: Re: mkdir with trailing / (patch proposed)
To: Bill Studenmund <email@example.com>
From: Matthew Orgass <firstname.lastname@example.org>
Date: 04/30/2002 19:55:55
On Tue, 30 Apr 2002, Bill Studenmund wrote:
> How? What programs/file systems crashed?
> I'm asking as ufs copies the length (which does NOT include the trailing
> slash(es)), and uses memcpy() to compare only length worth of bytes. So
> the value of that extra byte doesn't matter. NOTHING SEEMS TO BE EXPECTING
> THIS TRAILING '\0'.
> I'm not saying you didn't see crashes, I'm saying I don't see where they
> came from. Directory lookup (VOP_LOOKUP()) seems fine, and readdir
> (VOP_READDIR()) seems fine for ufs. What failed?
DIRSIZ expects the trailing '\0'. It doesn't look like there is any
memory corruption, but there is fs corruption. A DIAGNOSTIC kernel panics
with "bad dir" on accessing the directory created with a trailing slash,
failing the last check of ufs_dirbadentry. fsck also complains. It may
be that a kernel without DIAGNOSTIC would be fine until the disk needed to
be fscked for other reasons.
> > It is also needed for compatibility with systems that allow trailing
> > slashes on all files.
> > The following patches should now be a complete fix to this problem.
> > Trailing slashes are always allowed on Linux and SYSV; I don't know if any
> > others need it (ibcs2?).
> Well, your patch looks just like mine except you chose a different name,
> and made different emulations able to turn it on too. :-)
I said it was a complete patch, not a completely different patch :).