From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89833 invoked by alias); 30 Aug 2019 08:11:05 -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 89825 invoked by uid 89); 30 Aug 2019 08:11:05 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-114.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,GOOD_FROM_CORINNA_CYGWIN,NORMAL_HTTP_TO_IP,NUMERIC_HTTP_ADDR,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: mout.kundenserver.de Received: from mout.kundenserver.de (HELO mout.kundenserver.de) (212.227.17.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 30 Aug 2019 08:10:54 +0000 Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mysa4-1iPw4X0g4o-00vysE for ; Fri, 30 Aug 2019 10:10:51 +0200 Received: by calimero.vinschen.de (Postfix, from userid 500) id 9CB1DA804BA; Fri, 30 Aug 2019 10:10:50 +0200 (CEST) Date: Fri, 30 Aug 2019 08:20:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Cc: Eric Blake Subject: Re: Odd, is it not? mkdir 'e:\' cannot be undone by rmdir 'e:\' ... Message-ID: <20190830081050.GC27273@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com, Eric Blake 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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="DSayHWYpDlRfCAAQ" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-SW-Source: 2019-08/txt/msg00416.txt.bz2 --DSayHWYpDlRfCAAQ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 2875 Eric? On Aug 29 17:05, Houder wrote: > On Wed, 28 Aug 2019 16:22:20, Corinna Vinschen wrote: >=20 > > > 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] =3D3D=3D3D '/') > > > { > > > /* This converts // to /, but since both give EEXIST, we're okay.= */ > > > char *buf; > > > char *p =3D3D stpcpy (buf =3D3D tp.c_get (), dir) - 1; > > > dir =3D3D buf; > > > - while (p > dir && isdirsep (*p)) > > > + while (p > dir && *p =3D3D=3D3D '/') > > > *p-- =3D3D '\0'; > > > } > > > if (!(fh =3D3D build_fh_name (dir, PC_SYM_NOFOLLOW))) > >=20 > > One problem here is, what to do about border cases like > >=20 > > $ mkdir a\/\/\/ > >=20 > > 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. >=20 > How about dropping Eric's code snippet in winsup/cygwin/dir.cc ????? >=20 > Subdirectory 'a' is created. No problem there. Perhaps the patch has > become superfluous/ redundant over time? >=20 > I have tried different "values" for the path-argument to mkdir, and > have not found a problem while the code snippet is being skipped. >=20 > What am I missing? >=20 > Henri >=20 > ----- > 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] >=20 > Thread 1 "mkdir" hit Breakpoint 1, mkdir (dir=3D0x800041320 "a\\/\\/\\/",= mode=3D511) > 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. >=20 > Thread 1 "mkdir" hit Breakpoint 2, mkdir (dir=3D0x800041320 "a\\/\\/\\/",= mode=3D511) > at /usr/src/debug/cygwin-3.1.0-0.2/winsup/cygwin/dir.cc:326 > 326 if (!(fh =3D build_fh_name (dir, PC_SYM_NOFOLLOW))) > (gdb) c > Continuing. > [Inferior 1 (process 1064) exited normally] > (gdb) quit >=20 > 64-@@ ls -ld a* > drwxr-xr-x+ 1 Henri None 0 Aug 29 16:47 a >=20 > =3D=3D=3D=3D=3D >=20 >=20 > -- > 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 --=20 Corinna Vinschen Cygwin Maintainer --DSayHWYpDlRfCAAQ Content-Type: application/pgp-signature; name="signature.asc" Content-length: 833 -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl1o2goACgkQ9TYGna5E T6CpZBAAlZ1rkhcAyGUUS5LC4DEkWsZqTYSuMYqc9NnX/Y6aHr3r5SIUV6JwWkdP dWCS/SDjpwlKHxLFnR7iVYpxb4KubGi1jbJiUtkYiFm/oA/9HybjLMuzB7O1Tqnw MHtTzqVffPLIqT0nLpaP7jGKtAPsrGk8s063fEr+Ow2yRCE9Qr7+OCXVbDSfbnsf TxU/vneqXqtamwT41cA6ZGiYjY5KK9huBqkxnsvpYe2ZRw8uHPfWu35dLiTQKykD KxeDvgt0b3Jbjox4hnhBEPaM3saI0GIDG5Y9JAHdD8YPjlNKCwovK5enykpCWVlm f1/QSEoWaWSJ3hSjb2OuQEmRIH4Ad2gFEPaB5ZvKnj5A+WHAPZCf2oE8RrNj891O rhmDtc54esfPo0H4lDMcq/VMfU8lPvd3fZcNV+3PUbPccIu216pCwJfWHoJ3lp53 fuhGlFfBRxWw0QLN3xlNTbl3KObiTwyioXSi3ut9Oxo8SJM8iQ13s8K7wSuNRhqC I51YMgFr+/1u9rXcRdtKB8wKaMIKztEcMHfjAhmzlhWK96ISUeMSAFh9dy9CFtR2 UDWcbn2kxSwqc4IsuhxrzgY/9XcyxwLbCfzzRR59k+KsNHqxrD4hDRgkCznuZjQb q0DiOath/AvXwZht7qbJ99+2pcrntgSLCW7lz8PFUox/OWKGQSc= =byAz -----END PGP SIGNATURE----- --DSayHWYpDlRfCAAQ--