From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 1A52F3857C4E; Tue, 18 Jan 2022 11:02:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A52F3857C4E Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/cygwin-3_3-branch] Cygwin: path_conv: do not get confused by a directory with `.lnk` suffix X-Act-Checkin: newlib-cygwin X-Git-Author: Johannes Schindelin X-Git-Refname: refs/heads/cygwin-3_3-branch X-Git-Oldrev: 367b62859e06999979eead7bd849e68d3d239246 X-Git-Newrev: 7a8622667f479f58b61a4ecc49090ebb814c78bd Message-Id: <20220118110238.1A52F3857C4E@sourceware.org> Date: Tue, 18 Jan 2022 11:02:38 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Jan 2022 11:02:38 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D7a8622667f4= 79f58b61a4ecc49090ebb814c78bd commit 7a8622667f479f58b61a4ecc49090ebb814c78bd Author: Johannes Schindelin Date: Mon Jan 17 21:20:45 2022 +0100 Cygwin: path_conv: do not get confused by a directory with `.lnk` suffix =20 When trying to create a directory called `xyz` in the presence of a directory `xyz.lnk`, the Cygwin runtime errors out with an `ENOENT`. =20 The root cause is actually a bit deeper: the `symlink_info::check()` method tries to figure out whether the given path refers to a symbolic link as emulated via `.lnk` files, but since it is a directory, that is not the case, and that hypothesis is rejected. =20 However, the `fileattr` field is not cleared, so that a later `.exists()` call on the instance mistakenly thinks that the symlink actually exists. Let's clear that field. =20 This fixes https://github.com/msys2/msys2-runtime/issues/81 =20 Signed-off-by: Johannes Schindelin Diff: --- winsup/cygwin/path.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 5ab75f105..87ac2404a 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -3336,6 +3336,7 @@ restart: hasn't been found. */ if (ext_tacked_on && !had_ext && (fileattr & FILE_ATTRIBUTE_DIRECTOR= Y)) { + fileattr =3D INVALID_FILE_ATTRIBUTES; set_error (ENOENT); continue; }