Cygwin: path_conv: do not get confused by a directory with `.lnk` suffix

When trying to create a directory called `xyz` in the presence of a
directory `xyz.lnk`, the Cygwin runtime errors out with an `ENOENT`.

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.

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.

This fixes https://github.com/msys2/msys2-runtime/issues/81

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin 2022-01-17 21:20:45 +01:00 committed by Corinna Vinschen
parent e195f51af7
commit bd4fdcc059
1 changed files with 1 additions and 0 deletions

View File

@ -3336,6 +3336,7 @@ restart:
hasn't been found. */ hasn't been found. */
if (ext_tacked_on && !had_ext && (fileattr & FILE_ATTRIBUTE_DIRECTORY)) if (ext_tacked_on && !had_ext && (fileattr & FILE_ATTRIBUTE_DIRECTORY))
{ {
fileattr = INVALID_FILE_ATTRIBUTES;
set_error (ENOENT); set_error (ENOENT);
continue; continue;
} }