Subject: kern/8155: mkdir(1) and mkdir(2) behave different w/ trailing "/"
To: None <gnats-bugs@gnats.netbsd.org>
From: Hubert Feyrer <feyrer@rfhs8012.fh-regensburg.de>
List: netbsd-bugs
Date: 08/06/1999 06:05:51
>Number:         8155
>Category:       kern
>Synopsis:       mkdir(1) and mkdir(2) behave different w/ trailing "/"
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Aug  6 06:05:00 1999
>Last-Modified:
>Originator:     Hubert Feyrer
>Organization:
Hubert Feyrer <hubertf@channel.regensburg.org>
>Release:        1.4, mkdir(1) checked in current as of 19990806
>Environment:
	
System: NetBSD yui 1.4 NetBSD 1.4 (YUI) #22: Thu May 6 16:35:01 MEST 1999 feyrer@yui:/usr/cvs/src-1.4/sys/arch/i386/compile/YUI i386


>Description:
	mkdir(2) will fail if given "foo/", mkdir(1) won't:

  9672 myth2_demo_2.1 CALL  mkdir(0x8307840,0x1c0)
  9672 myth2_demo_2.1 NAMI  "./.loki/"
  9672 myth2_demo_2.1 RET   mkdir -1 errno -2 No such file or directory

% ls -lad ./.loki
ls: ./.loki: No such file or directory
yui% mkdir ./.loki/



>How-To-Repeat:
	Try myth2-demo (http://209.223.115.151/products/myth2/)

>Fix:
	Dunno.

	mkdir(1) strips off trailing spaces, though:

                /* Remove trailing slashes, per POSIX. */
                slash = strrchr(*argv, '\0');
                while (--slash > *argv && *slash == '/')
                        *slash = '\0';

	Maybe the kernel should do so, too? 
>Audit-Trail:
>Unformatted: