netheril96 / securefs

Filesystem in userspace (FUSE) with transparent authenticated encryption
Other
743 stars 63 forks source link

Windows: Maximum name path length (works fine) #82

Closed Owyn closed 2 years ago

Owyn commented 5 years ago

Was testing filename\path length limit, cuz I had some number of filenames exceeding it even disregarding folder names

results:

opening\working with folders on mountdir works fine, except for some minor issues: 1) renaming folders, trying to rename a folder which is a part of the issue results in an error "access denied" (only with disabled long paths windows settings) - with it enabled works fine 2) filename length check doesn't account for double-byte+ (probably) characters like russian language or just some symbols like dash and therefore doesn't calculate limit correctly for a proper error display, instead it gives "can not find this element" in the explorer and "syntax error" in the console: steps to reproduce:

[Error] [0000000000000904] [2019-09-11 18:00:43.867028000 UTC]    rename from=/241291-2200x1200-original-nanfe-long+hair-single-looking+at+viewer-highres to=/very long folder name just to test things out and see how it goes encounters exception class securefs::WindowsException (code=13): error 5 Access denied. (MoveFileExW(path1=\\?\V:\SF\V92D83W6G746NF8DPDE8UUA95XXV7HH4DIHT4PDU8EBQBM3YQZS2FKPVAHSPYRYUWV8YD3R7XEQFJ5HMUQ26FEWRJ5G8B54M7YWMYJSDFAN7S4TZ83WIK7D79MM96ZBRNIRENRVNJ6UG5PQ5, path2=\\?\V:\SF\WIYANA4BBFY8VTTDVYRE8IZX6C59RFJHESXGHI6D296KMU8EJHY6DQE4UFVDQP8V8MDJPVJXQCNMRH5ICRX24PZAQMWSSYJVNFBHE9HXFXWRUUDFFWU6559ZG84JNWG5NW))

Windows 10 b1903 SFS 0.8.3 WinFsp 2019.3 B2

in 2016 Microsoft officially made an option to disable the path limit of 260 https://mspoweruser.com/ntfs-260-character-windows-10/ enabling it for following functions:

CreateDirectoryW, CreateDirectoryExW, GetCurrentDirectoryW, RemoveDirectoryW, SetCurrentDirectoryW.

CopyFileW, CopyFile2, CopyFileExW, CreateFileW, CreateFile2, CreateHardLinkW, CreateSymbolicLinkW, DeleteFileW, FindFirstFileW, FindFirstFileExW, FindNextFileW, GetFileAttributesW, GetFileAttributesExW, SetFileAttributesW, GetFullPathNameW, GetLongPathNameW, MoveFileW, MoveFileExW, MoveFileWithProgressW, ReplaceFileW, SearchPathW, FindFirstFileNameW, FindNextFileNameW, FindFirstStreamW, FindNextStreamW, GetCompressedFileSizeW, GetFinalPathNameByHandleW.

thought it was long ago (since Win2k) possible to work with long file paths on NTFS using \\?\ prefix, but now in 2019 even without it and with just settings it would all work fine if user enabled long names in windows 10 settings

maybe it's a good idea to add this info to the README about enabling long path names in all modern versions of windows and say that securefs officially supports longs path now (all seem to work fine)

netheril96 commented 5 years ago

Is the actual data on a NTFS volume?

V: doesn't look like a label usually assigned to a disk partition.

Owyn commented 5 years ago

You can assign any drive letter to any partition on windows (including system one) It's NTFS изображение

netheril96 commented 5 years ago

securefs never needs the long path option, because it always interact with Windows API in the long form. From the log message you can see that the actual filename Windows see is like

\\?\V:\SF\WIYANA4BBFY8VTTDVYRE8IZX6C59RFJHESXGHI6D296KMU8EJHY6DQE4UFVDQP8V8MDJPVJXQCNMRH5ICRX24PZAQMWSSYJVNFBHE9HXFXWRUUDFFWU6559ZG84JNWG5NW

I can't reproduce your problem on my machine, with the same filenames. Could you give more details?

Owyn commented 5 years ago

WIYANA4BBFY8VTTDVY access denied happened only before I enabled long paths option for windows, now it doesn't

it's the error for renaming folders, trying to rename a folder which is a part of the issue results in an error "access denied" (only with disabled long paths windows settings) - with it enabled works fine

but you needed to also have a file with long filename inside that folder you are renaming to get this error access denied

netheril96 commented 2 years ago

The error is with Windows Explorer not properly supporting long paths, not securefs.