From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 87132 invoked by alias); 29 Aug 2019 15:05:54 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 87120 invoked by uid 89); 29 Aug 2019 15:05:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,NORMAL_HTTP_TO_IP,NUMERIC_HTTP_ADDR,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=Continuing, continuing X-HELO: lb2-smtp-cloud8.xs4all.net Received: from lb2-smtp-cloud8.xs4all.net (HELO lb2-smtp-cloud8.xs4all.net) (194.109.24.25) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 29 Aug 2019 15:05:43 +0000 Received: from tmp.camB4Ibo5B ([83.162.234.136]) by smtp-cloud8.xs4all.net with ESMTPSA id 3LzWiSdofDqPe3LzXiOc1R; Thu, 29 Aug 2019 17:05:41 +0200 Date: Thu, 29 Aug 2019 15:19:00 -0000 Message-ID: From: Houder Reply-To: cygwin@cygwin.com To: cygwin@cygwin.com Subject: Re: Odd, is it not? mkdir 'e:\' cannot be undone by rmdir 'e:\' ... References: <20190827152549.GY11632@calimero.vinschen.de> <3E262D05-F393-453A-9E43-B248DDE50812@solidrocksystems.com> <20190828125939.GL11632@calimero.vinschen.de> <421ac447-b249-da21-1ca5-228041cfc884@redhat.com> <20190828141556.GM11632@calimero.vinschen.de> <20190828142220.GN11632@calimero.vinschen.de> In-Reply-to: <20190828142220.GN11632@calimero.vinschen.de> Content-Type: text/plain; charset=UTF-8; format=fixed User-Agent: mua.awk 0.99 X-SW-Source: 2019-08/txt/msg00398.txt.bz2 On Wed, 28 Aug 2019 16:22:20, Corinna Vinschen wrote: > > As simple as that? > > > > diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc > > index b757851d5c7f..747b1582af50 100644 > > --- a/winsup/cygwin/dir.cc > > +++ b/winsup/cygwin/dir.cc > > @@ -314,13 +314,13 @@ mkdir (const char *dir, mode_t mode) > > set_errno (ENOENT); > > __leave; > > } > > - if (isdirsep (dir[strlen (dir) - 1])) > > + if (dir[strlen (dir) - 1] =3D=3D '/') > > { > > /* This converts // to /, but since both give EEXIST, we're okay. */ > > char *buf; > > char *p =3D stpcpy (buf =3D tp.c_get (), dir) - 1; > > dir =3D buf; > > - while (p > dir && isdirsep (*p)) > > + while (p > dir && *p =3D=3D '/') > > *p-- =3D '\0'; > > } > > if (!(fh =3D build_fh_name (dir, PC_SYM_NOFOLLOW))) > > One problem here is, what to do about border cases like > > $ mkdir a\/\/\/ > > In theory slashes and backslashes should both be treated as dir > separators. Handling a case like this so that all expectations > are satisfied is next to impossible, I guess. How about dropping Eric's code snippet in winsup/cygwin/dir.cc ????? Subdirectory 'a' is created. No problem there. Perhaps the patch has become superfluous/ redundant over time? I have tried different "values" for the path-argument to mkdir, and have not found a problem while the code snippet is being skipped. What am I missing? Henri ----- Breakpoint 1 at 0x1800548b9: file /usr/src/debug/cygwin-3.1.0-0.2/winsup/cygwin/dir.cc, line 317. Breakpoint 2 at 0x1800548e3: file /usr/src/debug/cygwin-3.1.0-0.2/winsup/cygwin/dir.cc, line 326. (gdb) r Starting program: /usr/bin/mkdir 'a\/\/\/' [New Thread 1064.0x1a8c] [New Thread 1064.0x59c] Thread 1 "mkdir" hit Breakpoint 1, mkdir (dir=0x800041320 "a\\/\\/\\/", mode=511) at /usr/src/debug/cygwin-3.1.0-0.2/winsup/cygwin/dir.cc:317 317 if (isdirsep (dir[strlen (dir) - 1])) (gdb) j dir.cc:326 Continuing at 0x1800548e3. Thread 1 "mkdir" hit Breakpoint 2, mkdir (dir=0x800041320 "a\\/\\/\\/", mode=511) at /usr/src/debug/cygwin-3.1.0-0.2/winsup/cygwin/dir.cc:326 326 if (!(fh = build_fh_name (dir, PC_SYM_NOFOLLOW))) (gdb) c Continuing. [Inferior 1 (process 1064) exited normally] (gdb) quit 64-@@ ls -ld a* drwxr-xr-x+ 1 Henri None 0 Aug 29 16:47 a ===== -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple