Subject: Re: mkdir with trailing / (patch proposed)
To: enami tsugutomo <enami@sm.sony.co.jp>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 04/29/2002 17:25:04
On 30 Apr 2002, enami tsugutomo wrote:

> Bill Studenmund <wrstuden@netbsd.org> writes:
>
> > Is it? I agree that the memcpy code is exactly the memcpy code you'd use
> > for a NUL terminated string. But for example ufs only looks at cn_namelen
> > characters. It copies cn_namelen + 1, but only ever looks at cn_namelen of
> > them. While adding a trailing '\0' might make dumps look nice, I don't
> > think we need it.
>
> Sorry, I meant that either
>
> 	(1) replace trailing slash for last componet with NUL.
> or
> 	(2) don't expect that the last componet doesn't have trailing
>             slash.  instead, use the length of the componet.
>
> is necessary, and I like (2).  Not saying that ``(2) is necessary
> anyway''.

I guess what I was trying to say is it looks like the code has gone with
(2) already. Other than the fact the ufs memcpy copies one extra byte
(acting as if there were a NUL there). :-)

> > either. It just seems a bit weird for RENAME to be adding CREATEDIR. :-)
>
> Doesn't it create new directory entry?  Anyway, the name doesn't so
> matter.

True. Move the bit in near the other operational ones (LOCKPARENT, etc.) &
trim the trailing NULL stuff, and I'm fine. Oh, shrinking the memcpy's to
not be "+ 1" would be fine.

Take care,

Bill