-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce filename length #499
Comments
Hmm, looking at this in detail, I don't understand why you get this error. The mentioned path
is 369 characters long. According to https://support.microsoft.com/en-us/office/restrictions-and-limitations-in-onedrive-and-sharepoint-64883a5d-228e-48f5-b3d2-eb39e07630fa#filenamepathlengths :
|
This contradicts the microsoft article |
Please note the definition of path length in the documentation. For example, for Sharepoint paths, the longer the company URL domain name and site name, the shorter the actual length the user can upload. Take the example in the documentation: The prefix has taken up 38 characters and is counted in the total path length.
This means that there are only 362 characters left to use. In my actual tests, I can only upload path lengths up to 342 characters under my account. Although gocryptfs shortens long filenames and keeps track of the actual filenames in a separate file, the names are still too long. Cryptomator also shortens filenames, but makes it so that conversion starts as soon as the encrypted file name reaches 220 characters (1 ASCII character = 1 byte). Whereas gocryptfs only does conversions when the filename exceeds 255 bytes. https://docs.cryptomator.org/en/1.5/security/architecture/#name-shortening However there is still the problem of the whole path being too long. |
Thank you for referring to this solution. The above mentioned approach uses Unicode characters with printable ranges for the file names. In my testing, using Unicode characters for encoding effectively addresses the file name and path length limitations of macOS AFPS, Windows NTFS file systems, and some cloud vendors (specifically, Microsoft OneDrive).
For OneDrive, the path length is calculated as the length of the decoded Unicode character, so it can easily carry more information. In my tests, the problem of long file names can be solved in this way and works with local file systems and cloud storage providers that support Unicode characters. |
I have too encountered issues with file names being too long and not working in gocryptfs in macOS. This happens a lot when the file names are in foreign languages. If the solution above solves it, that is great news. |
Yep, the boxcryptor's approach of using 4000 carefully chosen unicode chars seems viable. |
The boxcryptor thing is windows-only, won't use that one :) |
There is a smiley, so this is probably some jokey nudge. Let's get more to the point then - is there any technical concern why the "higher density encoding" (e.g. using those 4000 carefully chosen characters) couldn't be used by gocryptfs? |
Essentially, the boxcryptor trick works because on windows, the length limit is is counted in characters. That means you can have as many chinese characters as you could have ASCII characters. That is not the case on linux, where the limit is counted in bytes. And a chinese character takes more bytes than an ASCII one, which eats up the gains of having a larger alphabet. |
Yes, this is all clear. Though my intuition says it wouldn't eat up the gains on Linux (simply because Linux filesystems APIs have generaly much higher limits than Windows filesystems API) and second it would solve the OP's problem. |
My plan of action is is to add a command-line parameter to gocryptfs already stores names that are longer than 255 bytes in a |
@rfjakob does this mean many more people would need to back up also |
If you finally choose to add the such as |
@dumblob @BrsyRockSs Yes exactly,
|
Determines when to start hashing long names instead of hardcoded 255. Will be used to alleviate "name too long" issues some users see on cloud storage. #499
Feature flag + numeric paramater #499
@rfjakob I started working on adding longnamemax to cppcryptfs. I found that I still have this bug in cppcryptfs #143 that you fixed in gocryptfs years ago. I just wanted to point out that the gocryptfs man page still says 176 bytes where I think it should say 175. I don't understand why the gocryptfs man page says the minimum value for LongNameMax is 62, but the .name files are 67 chars (with the .name extension). Shouldn't the minimum LongNameMax value be 67 to reflect that files with names that long will be created? |
Quoting fusefrontend_reverse/node_helpers.go : // File names are padded to 16-byte multiples, encrypted and // base64-encoded. We can encode at most 176 bytes to stay below the 255 // bytes limit: // * base64(176 bytes) = 235 bytes // * base64(192 bytes) = 256 bytes (over 255!) // But the PKCS#7 padding is at least one byte. This means we can only use // 175 bytes for the file name. Noticed by @bailey27 at #499 (comment)
(1) 175 vs 176: Yes, this should read 175, thanks! Fixed in d530fbd . (2) 62 vs 67: Yes, as you have observed, the .name file is 67 bytes, example:
But, if you have nested directories, only the first file becomes part of the path. So with -longnamemax=62 you can get a shorter complete path. But the basename will still need 67 bytes. |
hi, thx for the function, or if possible mention the values in the manual (even list as unknown) etc. thanks |
@ccchan234 |
This comment was marked as spam.
This comment was marked as spam.
my next PC is gonna faster than most supercomputers 5 years ago...... |
This comment was marked as spam.
This comment was marked as spam.
can you tell more? even in win10 i enabled very very long path in registry, it's not enough for me. thanks |
Personal license $59.97 with gpt4 i could duplicate many small programs in a day. |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This "Long Path Tool" stuff is useless spam. Please don't feed the spammers. |
I am using
gocryptfs
to reverse encrypt some files and then sync the resulting encrypted files to OneDrive for remote backup. Everything seems to be working fine but when I sync to OneDrive using rclone I get a few errors of the form:I'm currently using the default feature flags as applied with the
-reverse
option, i.e.:Is there a way to make the encrypted filenames shorter?
I'm using
gocryptfs-1.8.0
as packaged in Fedora 32.The text was updated successfully, but these errors were encountered: