This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Odd, is it not? mkdir 'e:\' cannot be undone by rmdir 'e:\' ...
- From: Ken Brown <kbrown at cornell dot edu>
- To: "cygwin at cygwin dot com" <cygwin at cygwin dot com>
- Date: Sat, 21 Sep 2019 15:42:36 +0000
- Subject: Re: Odd, is it not? mkdir 'e:\' cannot be undone by rmdir 'e:\' ...
- 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
- 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=598Xd2cJIJgSGuAkoHmhyeXqbQ19pPPLLS5UnKiJVAc=; b=Iy1/zSrGzqVMmtBcU1TuIPiibZbDjf4TnqUR87vIAztNSL6FF6xRYYcj1qc0X5lBIIwstCpffnAsRQ16QvYB8pfiKtFfX/BXgTuZrMfKwLGsXaCe9MG2Lt+Bwl+tqpl0JH/yiPW965BbqP2TUgT7E6NAyv0K4O3FZGpym/qgKn4FeDdcexk+Mb06trGk7EkKS3z82uX+Wm+qSNwpiEcFxvsDepVqy5pEyByFTKwf0itXmMsYgs4p5NnMbhUNkc/LlfBhHLgL7ymeKSQLxGy4S5E1OPKy8FGAfUVVurbzmU/TZGZb7E3Iax7eY+6Ya2UzXSWXIvLhP57lDlLkrenczA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bM+BWmnKAiM711dt2a4npC/2d5cw1yz7RZMzRFJcmH+hP2wU5u/+d7aDYKA/hEY/K8AB89oWThbkezhjmUXJsp1zB44IvyBe8eLEXVUQO9vg5JL6AfaKGiyaW8UODrBDpo5urHQ0ztQHSp12vpa60ePmxQ/HG/qooZ4fw6pSKbsPO6Dv7nzx28ly4v6rqs7cT2Jsagfx/kM/w6gM+tvvuCky7N1WB636AvyDcOPcCf1PBcoTwmscKzPWSE7G6L1gSocfkD35sBbGrVCb3ObL8V/xJ80EB7mOgTviETkLuFTRXYBX1kg61HoXYdGNS/qAcVtycMxFuO0W6ASUD2Ru4Q==
- References: <bc3df101ab93c20b86c3ab7fa7d3ea4f@xs4all.nl> <20190827152549.GY11632@calimero.vinschen.de> <a47cc167b725c08e6f1c914166fabcaf@smtp-cloud8.xs4all.net> <3E262D05-F393-453A-9E43-B248DDE50812@solidrocksystems.com> <b97e4dbe952154efc68412540514ae81@smtp-cloud8.xs4all.net> <20190828125939.GL11632@calimero.vinschen.de> <421ac447-b249-da21-1ca5-228041cfc884@redhat.com> <20190828141556.GM11632@calimero.vinschen.de> <20190828142220.GN11632@calimero.vinschen.de> <ee1138b29ee4be60d62d86d59f581b2e@smtp-cloud8.xs4all.net> <4a87b7a940fb0cf76aac5f3bc5b1a8b3@smtp-cloud7.xs4all.net> <e438666b60ee08a2a3ee4ca16015382f@smtp-cloud9.xs4all.net> <f77b318f-0c52-4b5f-3738-ff882804e84a@cornell.edu> <e7cb47be199186f3c7438a0bfcc8c7df@smtp-cloud7.xs4all.net> <3eca1ecf200f0075efd154544c2fd5b4@smtp-cloud7.xs4all.net>
On 9/20/2019 5:11 AM, Houder wrote:
> As I said already, the snippet should NOT be executed in general. Perhaps
> it is another left-over from old times that should have been deleted.
You're absolutely right. Prior to commit b0717aae0, the code looked like this:
if (strncmp (path, "\\\\.\\", 4))
{
/* Windows ignores trailing dots and spaces in the last path
component, and ignores exactly one trailing dot in inner
path components. */
char *tail = NULL;
[...]
if (!tail || tail == path)
/* nothing */;
else if (tail[-1] != '\\')
{
*tail = '\0';
strip_tail = true;
}
else
{
error = ENOENT;
return;
}
}
Note the use of a *local* tail variable. It's a pointer into path, as you can
see by looking at the part I omitted.
In commit b0717aae0, Corinna intended to disable this code, but she
inadvertently disabled only part of it. Here's the relevant part of that commit:
@@ -1170,6 +1225,7 @@ out:
{
if (strncmp (path, "\\\\.\\", 4))
{
+#if 0
/* Windows ignores trailing dots and spaces in the last path
component, and ignores exactly one trailing dot in inner
path components. */
@@ -1190,7 +1246,7 @@ out:
tail = NULL;
}
}
-
+#endif
if (!tail || tail == path)
/* nothing */;
else if (tail[-1] != '\\')
In particular, the declaration of the local tail variable is in the disabled
code, so the cruft at the end is referring to the other tail, which points into
path_copy.
[A later commit removed the disabled code.]
I'll fix this and then look at your patches to mkdir and rmdir. It would be
very helpful if you would write these as a patch series with cover letter, using
git format-patch, and send them to the cygwin-patches list.
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