From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 118819 invoked by alias); 19 Sep 2019 18:04:52 -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 118812 invoked by uid 89); 19 Sep 2019 18:04:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-4.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=Odd, enoent, ENOENT, device X-HELO: NAM02-SN1-obe.outbound.protection.outlook.com Received: from mail-eopbgr770097.outbound.protection.outlook.com (HELO NAM02-SN1-obe.outbound.protection.outlook.com) (40.107.77.97) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Sep 2019 18:04:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Is+kArcsxEYTS5M7jkPCumM3SAwZm3NTyXRsWYRmmVCBiN3qMFm6+XIglnR3z1IpARhujrBqQutkpXdTJWdlykp3yvNl1PTgGduOSnCCRxRDASwiQDALNcCqRDeIrlAL/SM4kl3fT5CaddhpQ4LyzE9xOCrcfI+ZXPgU3ueMpRxAK+MBVQ317D0UBPfwStQyWtcErg06jP6bytMzW+fF8L4hwxPC8j6RtcqBqGPClS7kut+zdXcfmm5bMDnlCnxW3TaG0H2MfisV8KkplN/e3e+XGVOgDZ8XP8cYefU89g8YZk9vlTUbybntIO4ORtEC2Zry3X0g4jyN902T3jKj7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=t9+V0rwmOGVnoJUvHuTm0eoYqyC04OU/alJUGP/sDn4=; b=AdUjCTF3wW/1vqOBw6CqAwh9428qez0eCkUj+4T1JIKRuJbPu7SMw8vLPZjNhCBeRklKWZiJBUJbdKg/Xjzx4c1zmO3NBYVJfzMvHEPiqpwmoszbJKCQabL1fxtpkwg/B4CXaBBRdBdeVLWaWZOX0qUutUnFcKfSbgZeVAcvNI4sdIIbTKISEihXQWmEWpLGE4YS2umsF+NhVhlyeMAmoVGCQWMiLeV9CfhSxzo88N8H/5kaxa1kOryfO5K/c3KIXgq4+st2K5IA7LAjhkipSkwFSXRv2I6r1RmCgpTGc1DEgEHNT1q9A5cXZJZptJ99CiyM+8ZlZ/H8TCXZw4sY9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cornell.edu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=t9+V0rwmOGVnoJUvHuTm0eoYqyC04OU/alJUGP/sDn4=; b=W9v8zUHOr20apXZwS2qKd7T+sUVJjHngUbE9/ZgnypiWobZvM4xntmjbL8eBKUPFEDZBbAnWMdUge3q3GALwk6jiHHcdFMOXRer7wclTWtF3gc45fJNZuAcmn0pi8v+RM3KIaecM3oBqtC9iwk/0Ar8EQwO5Y8dpwCrY9pny274= Received: from DM6PR04MB5738.namprd04.prod.outlook.com (20.179.51.81) by DM6PR04MB5531.namprd04.prod.outlook.com (20.178.224.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.24; Thu, 19 Sep 2019 18:04:47 +0000 Received: from DM6PR04MB5738.namprd04.prod.outlook.com ([fe80::998b:a76c:fc2b:1473]) by DM6PR04MB5738.namprd04.prod.outlook.com ([fe80::998b:a76c:fc2b:1473%4]) with mapi id 15.20.2263.023; Thu, 19 Sep 2019 18:04:47 +0000 From: Ken Brown To: "cygwin@cygwin.com" Subject: Re: Odd, is it not? mkdir 'e:\' cannot be undone by rmdir 'e:\' ... Date: Thu, 19 Sep 2019 19:51:00 -0000 Message-ID: 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> <4a87b7a940fb0cf76aac5f3bc5b1a8b3@smtp-cloud7.xs4all.net> In-Reply-To: user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 authentication-results: spf=none (sender IP is ) smtp.mailfrom=kbrown@cornell.edu; x-ms-oob-tlc-oobclassifiers: OLM:8882; received-spf: None (protection.outlook.com: cornell.edu does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="Windows-1252" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: OkFzrWvGTPtoNdDYXcvLGKgMpzsTyVztvk5vyAgOlUOE2PEQt0MaJM6VlDAmL+Rs98RFx8GdxF7z1NPI1CUTbA== X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg00206.txt.bz2 On 9/1/2019 1:38 PM, Houder wrote: > On Fri, 30 Aug 2019 11:54:27, Houder wrote: [...] > As the directory "/foo" had been correctly created, I turned to > path_conv::check(), which is called when build_fhname() creates > the path_conv object (also called pc) -- see dtable.cc. >=20 > Examining this (obsure) method in path.cc, I corrected the code > in 2 places: >=20 > --- > if (dev.isfs ()) > { > //if (strncmp (path, "\\\\.\\", 4)) <=3D=3D=3D=3D 1171 > if ( ! strncmp (path, "\\\\.\\", 4)) // <=3D=3D=3D=3D [1] > { > if (!tail || tail =3D=3D path) > /* nothing */; > else if (tail[-1] !=3D '\\') > *tail =3D '\0'; <=3D=3D=3D=3D Ah! (you should not do tha= t!) > else > { > error =3D ENOENT; > return; > } > } >=20 > [1] this code should be executed only if path =3D=3D '\\.\' !! I don't agree with your analysis here. First, the strncmp() call is testing whether path *starts with* '\\.\', not= =20 whether path =3D=3D '\\.\'. For example, path might be a UNC device name l= ike=20 '\\.\c:'. Second, as the original code indicates (before your correction),= we=20 do *not* want to execute the code in that case, since we might be mutilatin= g the=20 device name or incorrectly setting ENOENT. On the other hand, I agree that there's something wrong with that code snip= pet.=20 Comparing tail with path [which is the class member this->path] makes no se= nse=20 here, because tail is a pointer into path_copy. So I think line 1173 shoul= d read if (!tail || tail =3D=3D path_copy) If this condition fails, then it's legitimate to refer to tail[-1] two line= s later. Observe next that path_copy contains no backslashes, so I think line 1175 s= hould=20 probably be else if (tail[-1] !=3D '/') I don't immediately see why we would then set *tail =3D '\0' in this case, = because=20 I think *tail is already 0 if we get here and tail[-1] !=3D '/'. But maybe= I'm=20 missing something. I need to think about this further, but I wanted to write down my initial=20 thoughts before your bug report gets forgotten. To be continued. Ken -- 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