Subject: bin/831: mkdir -p complains
To: None <gnats-admin@NetBSD.ORG>
From: Simon J. Gerraty <sjg@hobbit.dn.itg.telecom.com.au>
List: netbsd-bugs
Date: 02/28/1995 17:50:04
>Number:         831
>Category:       bin
>Synopsis:       mkdir -p /usr/obj/cat complains if dir exits
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 28 17:50:03 1995
>Originator:     Simon J. Gerraty
>Organization:
Zen Programming...
>Release:        NetBSD-1.0 and Jan08-current
>Environment:
	
System: NetBSD hobbit 1.0A NetBSD 1.0A (VOLVOX) #1: Mon Jan 9 16:34:08 MET 1995 pk@chroom:/usr/src/sys/arch/sparc/compile/VOLVOX sparc


>Description:
	
make obj uses mkdir -p to ensure that /usr/obj/* exist.
However, mkdir -p complains and exit(1)s if dir exists.
I don't know about POSIX, but SunOS and HP/UX certainly 
do not behave this way.
>How-To-Repeat:
	
# cd /usr/src/bin/cat
# make obj
# make obj
>Fix:
	
*** bin/mkdir/mkdir.c.~1~	Tue Nov 22 08:20:47 1994
--- bin/mkdir/mkdir.c	Wed Mar  1 12:21:39 1995
***************
*** 113,120 ****
--- 113,122 ----
  			continue;
  		}
  		if (mkdir(*argv, omode) < 0) {
+ 			if (pflag == 0 || errno != EEXIST) {
  				warn("%s", *argv);
  				exitval = 1;
+ 			}
  		}
  	}
  	exit(exitval);
>Audit-Trail:
>Unformatted: