Subject: Re: mkdir with trailing / (patch proposed)
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-kern
Date: 04/29/2002 21:23:18
In article <Pine.NEB.4.33.0204290936120.29181-200000@vespasia.home-net.internetconnect.net>,
Bill Studenmund <wrstuden@netbsd.org> wrote:
>-=-=-=-=-=-
>
>On Sun, 28 Apr 2002, Bill Sommerfeld wrote:
>
>> A more correct way to do this would involve the introduction of a new
>> namei operational flag, passing that from mkdir(), and if that flag is
>> set, trimming the trailing slashes off the pathname early in namei().
>
>Or not worry about trailing slashes on the last component if we have said
>flag set.
>
>The attached patch adds a new flag, NOREQLAST, which means to not
>REQUIREDIR on the last path component. When this is set, the last
>component not existing won't generate an error on lookup.
>
>I made a test version of mkdir which didn't remove trailing slashes, and
>mkdir worked.
>

So what is the right behavior


Solaris:

mkdir new/
cd new
echo foo > zap/
cat zap/
rm zap
cd ..
rmdir new/

Linux
mkdir new/
cd new
echo foo > zap/
zap/: Is a directory
echo foo > zap
cat zap/
zap/: Not a directory
rm zap
cd ..
rmdir new/

christos