This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 3.0.7(0.338/5/3): Possible reference to Developer's instances of dev files in deployed build


On 12/6/2019 9:34 AM, Corinna Vinschen wrote:
> On Dec  6 12:07, Corinna Vinschen wrote:
>> Right.  Cygwin uses a simple mechanism to check the drives to show
>> under /cygdrive.  Basically it just calls the Win32 function
>> GetLogicalDriveStrings(), then, for each drive, it checks the
>> QueryDosDevice mapping.  Right now it only accepts cdrom, floppy,
>> harddrive, LanmanRedirector (SMB) and MRxNfs (NFS).  All other
>> drive types are treated as "no disk".  This is fixable with probably not
>> too much effort.
> 
> Ah, yes, there's a problem.  When listing /cygdrive, we're trying to do
> this as quick as possible.  For network drives, we check if they are
> available using a function NetUseGetInfo, which only takes a few ms,
> even if the drive is unavailable.
> 
> As soon as this function returns the state "disconnected", Cygwin
> skips the drive in /cygdrive.
> 
> However, this function does not know anything about client side caching
> (CSC).  To find out if the drive is available via CSC, the drive
> has to be opened and checked for filesystem information, which reflects
> the state that the filesystem is still available offline.
> 
> The problem with this approach is, it would have to be called for
> each unavailable drive in /cygdrive.  This takes multiple secs per
> drive.  That's exacly what we tried to avoid when calling the
> aforementioned NetUseGetInfo function in the first place.
> 
> Checking for a CSC-ed drive when disconnected would make /cygdrive
> listing very slow, just as in the old days...

I don't have any words of wisdom here, but I need to correct something I said 
earlier.

On 12/4/2019 3:50 PM, Ken Brown wrote:
> I don't have time to check this carefully at the moment, but it looks like 
> what's happening is the following:
> 
> path_conv::check is called on 'Z:\'.  It strips the trailing backslash and calls 
> mount_info::conv_to_win32_path on 'Z:'.  NtCreateFile fails with 
> STATUS_OBJECT_NAME_NOT_FOUND, which triggers the code containing the assertion. 
> The assertion fails because 'Z:' doesn't contain a backslash.

This is not quite right.  It's true that path_conv::check strips the trailing 
backslash from Z:\, but then it adds it back before calling symlink_info::check:

       /* If path is only a drivename, Windows interprets it as the
	 current working directory on this drive instead of the root
	 dir which is what we want. So we need the trailing backslash
	 in this case. */
       if (full_path[0] && full_path[1] == ':' && full_path[2] == '\0')
	{
	  full_path[2] = '\\';
	  full_path[3] = '\0';
	}

Thus symlink_info::check is in fact called on Z:\, but the assertion fails 
because the code at path.cc:2905 is looking for a backslash prior to the 
trailing backslash.  So maybe the right fix for the assertion failure is the 
following:

--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -2895,7 +2895,8 @@ restart:
              slow down normal operation.  This extra check only kicks in if
              we encountered a STATUS_OBJECT_NAME_NOT_FOUND *and* we didn't
              already attach a suffix. */
-         if (!restarted && !*ext_here && !(mount_flags & MOUNT_DOS))
+         if (!restarted && !*ext_here && ext_here[-1] != '\\'
+             && !(mount_flags & MOUNT_DOS))
             {
               /* Check for trailing dot or space or leading space in
                  last component. */

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]