On Wed, 12 Feb 2025, Jeremy Drake via Cygwin-patches wrote: > On Wed, 12 Feb 2025, Jeremy Drake via Cygwin-patches wrote: > > > It was *supposed* to not return the second one. Maybe I broke it when > > trying to break out of the loop early... I will test this scenario and > > see why it doesn't work as expected. > > Yeah, I never actually looked at how posix_sorted was sorted. It's sorted > by length first, then by strcmp. This was probably a premature > optimization anyway. conv_to_posix_path doesn't try to bail early, it > just continues, and that's going to be a much more common code path than > this...
Not only that, but there's a sash-vs-backslash mismatch between native_path and mnt_fsname resulting in the strcasematch not matching. I must have only tested the root-of-drive-letter case (where the paths are like C:), because that was the case the existing code was handling: diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc index 4be24fbe84..ef3070dbe1 100644 --- a/winsup/cygwin/mount.cc +++ b/winsup/cygwin/mount.cc @@ -1645,14 +1645,8 @@ fillout_mntent (const char *native_path, const char *posix_path, unsigned flags) struct mntent& ret=_my_tls.locals.mntbuf; bool append_bs = false; - /* Remove drivenum from list if we see a x: style path */ if (strlen (native_path) == 2 && native_path[1] == ':') - { - int drivenum = cyg_tolower (native_path[0]) - 'a'; - if (drivenum >= 0 && drivenum <= 31) - _my_tls.locals.available_drives &= ~(1 << drivenum); append_bs = true; - } I have a fix for these, and I also added a patch 3 on top which removes the de-duplication code and calls cygdrive_posix_path instead of conv_to_posix_path. You can not apply patch 3, apply patch 3 in case it has to be reverted later, or squash it into 2 if you prefer, there's options.