X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:references :in-reply-to:content-type:content-id:content-transfer-encoding :mime-version; q=dns; s=default; b=qHDe7ixoybsspgJpNjCtisbdd5atv BFbP8QDk2yULRW8yqND+zy+C06ir2K8dMIKwvAauZkhRxlAo+ru3bdY3b0j/Ypqx P3CJnc4mtChBp5U/fMeb9Wg+37XFx9MZV8+NVky+FOzx+hI3kSitj90T681kiIPr Va4LNAdQTpdlUA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:references :in-reply-to:content-type:content-id:content-transfer-encoding :mime-version; s=default; bh=Q7zraMcGxpj8FCLUiDkQafnD8Js=; b=dZ7 66EyBFRUvTsHS7PUXYIuV+OPeoRqIydfrS/8ZUNO+IzYbRKIWlkyzVau6PZSI5lz Ah+i/Q7F4a52U30tJWXZGbN3jUkDSAF8seZnMFSMYxfkJWk6j9S8C+qQ0kRWr9fS 47q0oK2DTncpx6rwqaPfGIKXtS08Dzq5Hbrm2o3w= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 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 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= From: Ken Brown To: "cygwin AT cygwin DOT com" Subject: Re: Odd, is it not? mkdir 'e:\' cannot be undone by rmdir 'e:\' ... Date: Thu, 19 Sep 2019 18:04:47 +0000 Message-ID: References: <20190827152549 DOT GY11632 AT calimero DOT vinschen DOT de> <3E262D05-F393-453A-9E43-B248DDE50812 AT solidrocksystems DOT com> <20190828125939 DOT GL11632 AT calimero DOT vinschen DOT de> <421ac447-b249-da21-1ca5-228041cfc884 AT redhat DOT com> <20190828141556 DOT GM11632 AT calimero DOT vinschen DOT de> <20190828142220 DOT GN11632 AT calimero DOT vinschen DOT de> <4a87b7a940fb0cf76aac5f3bc5b1a8b3 AT smtp-cloud7 DOT xs4all DOT 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 AT cornell DOT 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: MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: OkFzrWvGTPtoNdDYXcvLGKgMpzsTyVztvk5vyAgOlUOE2PEQt0MaJM6VlDAmL+Rs98RFx8GdxF7z1NPI1CUTbA== X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id x8JI5QRG029205 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. > > Examining this (obsure) method in path.cc, I corrected the code > in 2 places: > > --- > if (dev.isfs ()) > { > //if (strncmp (path, "\\\\.\\", 4)) <==== 1171 > if ( ! strncmp (path, "\\\\.\\", 4)) // <==== [1] > { > if (!tail || tail == path) > /* nothing */; > else if (tail[-1] != '\\') > *tail = '\0'; <==== Ah! (you should not do that!) > else > { > error = ENOENT; > return; > } > } > > [1] this code should be executed only if path == '\\.\' !! I don't agree with your analysis here. First, the strncmp() call is testing whether path *starts with* '\\.\', not whether path == '\\.\'. For example, path might be a UNC device name like '\\.\c:'. Second, as the original code indicates (before your correction), we do *not* want to execute the code in that case, since we might be mutilating the device name or incorrectly setting ENOENT. On the other hand, I agree that there's something wrong with that code snippet. Comparing tail with path [which is the class member this->path] makes no sense here, because tail is a pointer into path_copy. So I think line 1173 should read if (!tail || tail == path_copy) If this condition fails, then it's legitimate to refer to tail[-1] two lines later. Observe next that path_copy contains no backslashes, so I think line 1175 should probably be else if (tail[-1] != '/') I don't immediately see why we would then set *tail = '\0' in this case, because I think *tail is already 0 if we get here and tail[-1] != '/'. But maybe I'm missing something. I need to think about this further, but I wanted to write down my initial 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