You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The GVFS.Service service is running as local system.
If a directory is cloned into a directory that only has ACLs (full control) for a specific user... say:
D:\os.2>ICACLS .
. REDMOND\gabrield:(OI)(CI)(F)
Then auto-mount fails because the service cannot open the directory when it tries to fix the path casing.
This can be corrected in two ways..
First, use .net to fix the path casing instead of PInvoking into native APIs. (I have confirmed this works with ACL changse).
Second, GVFS clone should ensure that the ACLs on the clone directory are properly set for the access rights it needs.
For the first issue, the fix is using the following code in WindowsFileSystem.Shared.cs
usingGVFS.Common;usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.IO;usingSystem.Linq;namespaceGVFS.Platform.Windows{publicpartialclassWindowsFileSystem{/// <summary>/// Getting the logical drives isn't exactly super fast (it isn't super slow either)./// It is super unlikely that the drive set will change while the server is running./// </summary>privatestaticreadonlyLazy<IReadOnlyDictionary<string,string>>LogicalDrives=newLazy<IReadOnlyDictionary<string,string>>(()=>{varlogicalDrives=Directory.GetLogicalDrives();vardictionary=newDictionary<string,string>(logicalDrives.Length,StringComparer.OrdinalIgnoreCase);foreach(varlogicalDriveinlogicalDrives){dictionary.Add(logicalDrive,logicalDrive);}returndictionary;});publicstaticboolTryGetNormalizedPathImplementation(stringpath,outstringnormalizedPath,outstringerrorMessage){normalizedPath=null;errorMessage=null;try{if(!(File.Exists(path)||Directory.Exists(path))){errorMessage="Path does not exist: "+path;returnfalse;}// We don't want ".." etc in our file paths.path=Path.GetFullPath(path);// Build a list of DirectoryInfo objects so we can use them to retrieve// the "file system info".vardirectoryInfoList=newList<DirectoryInfo>();for(vardi=newDirectoryInfo(path);di!=null;di=di.Parent){// Always insert at the head to make sure the path parts are in the correct order.directoryInfoList.Insert(0,di);}// Now, create a IEnumerable<string> from them.normalizedPath=Path.Combine(directoryInfoList.Select((foundEntry)=>{// If we have a parent "directory info" (which is true for every path part except the root - i.e. drive letter)// then ask the parent to get the "File System Info" for ourselves, and THAT gives us the correct casing.if(foundEntry.Parent!=null){returnfoundEntry.Parent.GetFileSystemInfos(foundEntry.Name).First().Name;}// Now, for the root, well, we will ask the file system to give us the logical// drives and then when we find a match, return what it gave us.if(LogicalDrives.Value.TryGetValue(foundEntry.Name,outvarfixedDriveCasing)){returnfixedDriveCasing;}// Finally, if we couldn't find that, just return to upper on the entry, which makes this work for UNC shares.returnfoundEntry.Name.ToUpperInvariant();}).ToArray());}catch(Win32Exceptione){errorMessage="Could not get path root. Failed to determine volume: "+e.Message;returnfalse;}returntrue;}}}
I have not yet had time to investigate the clone code to add "full control" to the clone directory.
The text was updated successfully, but these errors were encountered:
The GVFS.Service service is running as local system.
If a directory is cloned into a directory that only has ACLs (full control) for a specific user... say:
D:\os.2>ICACLS .
. REDMOND\gabrield:(OI)(CI)(F)
Then auto-mount fails because the service cannot open the directory when it tries to fix the path casing.
This can be corrected in two ways..
First, use .net to fix the path casing instead of PInvoking into native APIs. (I have confirmed this works with ACL changse).
Second, GVFS clone should ensure that the ACLs on the clone directory are properly set for the access rights it needs.
For the first issue, the fix is using the following code in WindowsFileSystem.Shared.cs
I have not yet had time to investigate the clone code to add "full control" to the clone directory.
The text was updated successfully, but these errors were encountered: