Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com To: Eric Blake Cc: "Pierre A. Humblet" , cygwin AT cygwin DOT com, bug-coreutils AT gnu DOT org Subject: Re: mkdir -p and network drives References: <3 DOT 0 DOT 5 DOT 32 DOT 20050502232204 DOT 00b52180 AT incoming DOT verizon DOT net> <42777719 DOT 8090103 AT byu DOT net> From: Paul Eggert Date: Thu, 05 May 2005 01:09:24 -0700 In-Reply-To: <42777719.8090103@byu.net> (Eric Blake's message of "Tue, 03 May 2005 07:05:29 -0600") Message-ID: <8764xym6vf.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Eric Blake writes: > The only other approach I can think of is to special case leading // (at > least on cygwin, leading // should start after //MACHINE/Share/) What happens with the file names "//", "//MACHINE", and "//MACHINE/Share" in Cygwin? Don't they appear to be directories, albeit directories that you can't alter? If not, that suggests a bug in Cygwin. > not all POSIX-compliant hosts have the same semantics for leading // As far as I know the only extant hosts with this problem are Windows-based hosts. Apollo DomainOS was the only other example, but it's dead. I don't know the semantics under the Windows-based hosts, so I'm not qualified to write a general fix. (And if it's too complicated, we probably don't want to maintain it.) That being said, it can't hurt to add the following minor workaround, (which would work on Domain OS anyway :-), so I installed it. 2005-05-05 Paul Eggert * makepath.c (make_path): chdir to "//", not "/", if the file name starts with exactly two slashes. This doesn't solve the problem in general but it's better than nothing. Problem reported by Pierre A. Humblet via Eric Blake. --- makepath.c.~1.60.~ 2004-07-30 13:29:01 -0700 +++ makepath.c 2005-05-05 00:54:19 -0700 @@ -207,8 +207,14 @@ make_path (const char *argpath, /* If we've saved the cwd and DIRPATH is an absolute pathname, we must chdir to `/' in order to enable the chdir optimization. So if chdir ("/") fails, turn off the optimization. */ - if (do_chdir && *dirpath == '/' && chdir ("/") < 0) - do_chdir = false; + if (do_chdir && dirpath[0] == '/') + { + /* POSIX says "//" might be special, so chdir to "//" if the + file name starts with exactly two slashes. */ + char const *root = "//" + (dirpath[1] != '/' || dirpath[2] == '/'); + if (chdir (root) != 0) + do_chdir = false; + } slash = dirpath; -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/