Skip to content
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

[Bug]: windows app crash, "Error setting mtime for" file paths longer than 260 characters #7265

Closed
5 of 8 tasks
kmwoley opened this issue Oct 4, 2024 · 3 comments
Closed
5 of 8 tasks
Labels
bug confirmed bug approved by the team

Comments

@kmwoley
Copy link

kmwoley commented Oct 4, 2024

⚠️ Before submitting, please verify the following: ⚠️

Bug description

When syncing files from the server to the client on Windows, files with a local path slightly smaller than 260 characters (and over 260 characters) crash the application. It appears that the issue is the length of the temporary file path that's created during sync; when that temporary file name is longer than 260 characters, I see this error.

Example:
This file path is 259 characters long:
C:/Users/uuuuu/Nextcloud/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/x__filename__x.pdf

During the sync process, it appears that the filename is prepended with a '.' and appended with a unique string (e.g. '.~47fc').

This results in an error when setting mtime:
2024-10-03 16:35:56:955 [ warning nextcloud.sync.filesystem C:\Users\User\AppData\Local\Temp\windows-26085\client-building\desktop\src\libsync\filesystem.cpp:204 ]: Error setting mtime for "C:/Users/uuuuu/Nextcloud/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/x__filename__x.pdf.~47fc" failed: rc -1 , errno: 20

Steps to reproduce

  1. Create a network path and file name that is sufficiently long (i.e. when it syncs from the server to the client, the local path is one or two characters shorter than 260 characters)
  2. Sync the folder as virtual files
  3. In Explorer, Select the folder containing the long path name and select "Always keep on this device"

The sync will start but then crash the app when it gets to the file path that is too long.

Expected behavior

I would expect to:

  1. Get a warning that the file name is too long and that it should be made shorter on the server so it can sync to the client.
  2. Even better would be if the client was compatible with Windows LongPathsEnabled

Which files are affected by this bug

filesystem.cpp

Operating system

Windows

Which version of the operating system you are running.

Windows 11 Home (10.0.22631 Build 22631)

Package

Official Windows MSI

Nextcloud Server version

30.0.0

Nextcloud Desktop Client version

3.14.1

Is this bug present after an update or on a fresh install?

Fresh desktop client install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

Are you using an external user-backend?

  • Default internal user-backend
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Nextcloud Server logs

No response

Additional info

Redacted client log snippet:

2024-10-03 16:35:56:940 [ info nextcloud.sync.checksums C:\Users\User\AppData\Local\Temp\windows-26085\client-building\desktop\src\common\checksums.cpp:204 ]:	Computing "SHA1" checksum of "C:/Users/uuuuu/Nextcloud/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/x__filename__x.pdf.~47fc" in a thread
2024-10-03 16:35:56:940 [ debug nextcloud.sync.networkjob C:\Users\User\AppData\Local\Temp\windows-26085\client-building\desktop\src\libsync\abstractnetworkjob.cpp:297 ]	[ OCC::AbstractNetworkJob::slotFinished ]:	Network job OCC::GETFileJob finished for "/Family Documents/Work (Kevin)/EnergySavvy/Dropbox/RFPs/2 In Process/National Grid DG March 2016/2 Kim Folder/National Grid Contractor Requirements for Compliance with NERC Cyber Security Standards CIP-002 through CIP-009_02162012.pdf"
2024-10-03 16:35:56:940 [ debug nextcloud.sync.networkjob.get C:\Users\User\AppData\Local\Temp\windows-26085\client-building\desktop\src\libsync\propagatedownload.cpp:332 ]	[ OCC::GETFileJob::slotReadyRead ]:	Get file job finished bytesAvailable/_saveBodyToFile: 0 / true
2024-10-03 16:35:56:953 [ debug nextcloud.sync.filesystem C:\Users\User\AppData\Local\Temp\windows-26085\client-building\desktop\src\libsync\filesystem.cpp:67 ]	[ OCC::FileSystem::filePathLockFilePatternMatch ]:	Checking if it is a lock file: "C:/Users/uuuuu/Nextcloud/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/x__filename__x.pdf.~47fc"
2024-10-03 16:35:56:953 [ debug nextcloud.gui.folderwatcher C:\Users\User\AppData\Local\Temp\windows-26085\client-building\desktop\src\gui\folderwatcher.cpp:226 ]	[ OCC::FolderWatcher::changeDetected ]:	Locked files: QList()
2024-10-03 16:35:56:953 [ debug nextcloud.gui.folderwatcher C:\Users\User\AppData\Local\Temp\windows-26085\client-building\desktop\src\gui\folderwatcher.cpp:236 ]	[ OCC::FolderWatcher::changeDetected ]:	Unlocked files: QList()
2024-10-03 16:35:56:953 [ debug nextcloud.gui.folderwatcher C:\Users\User\AppData\Local\Temp\windows-26085\client-building\desktop\src\gui\folderwatcher.cpp:237 ]	[ OCC::FolderWatcher::changeDetected ]:	Locked files: QSet()
2024-10-03 16:35:56:953 [ info nextcloud.gui.folderwatcher C:\Users\User\AppData\Local\Temp\windows-26085\client-building\desktop\src\gui\folderwatcher.cpp:252 ]:	Detected changes in paths: QSet("C:/Users/uuuuu/Nextcloud/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/x__filename__x.pdf.~47fc")
2024-10-03 16:35:56:954 [ debug nextcloud.gui.folder C:\Users\User\AppData\Local\Temp\windows-26085\client-building\desktop\src\gui\folder.cpp:911 ]	[ OCC::Folder::pathIsIgnored ]:	* Ignoring file "C:/Users/uuuuu/Nextcloud/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/x__filename__x.pdf.~47fc"
2024-10-03 16:35:56:954 [ debug nextcloud.sync.vfs.cfapi C:\Users\User\AppData\Local\Temp\windows-26085\client-building\desktop\src\libsync\vfs\cfapi\vfs_cfapi.cpp:330 ]	[ OCC::VfsCfApi::pinStateLocal ]:	Couldn't find pin state for regular non-placeholder file "C:\\Users\\uuuuu\\Nextcloud\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\Redacted\\.x__filename__x.pdf.~47fc"
2024-10-03 16:35:56:954 [ debug nextcloud.sync.vfs.cfapi C:\Users\User\AppData\Local\Temp\windows-26085\client-building\desktop\src\libsync\vfs\cfapi\vfs_cfapi.cpp:303 ]	[ OCC::VfsCfApi::setPinState ]:	setPinState "Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/x__filename__x.pdf.~47fc" (4)
2024-10-03 16:35:56:955 [ debug nextcloud.sync.propagator.download C:\Users\User\AppData\Local\Temp\windows-26085\client-building\desktop\src\libsync\propagatedownload.cpp:1183 ]	[ OCC::PropagateDownloadFile::downloadFinished ]:	setModTime "C:/Users/uuuuu/Nextcloud/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/x__filename__x.pdf.~47fc" 1642174567
2024-10-03 16:35:56:955 [ warning nextcloud.sync.filesystem C:\Users\User\AppData\Local\Temp\windows-26085\client-building\desktop\src\libsync\filesystem.cpp:204 ]:	Error setting mtime for "C:/Users/uuuuu/Nextcloud/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/Redacted/x__filename__x.pdf.~47fc" failed: rc -1 , errno: 20
@kmwoley
Copy link
Author

kmwoley commented Oct 4, 2024

I should mention that the temporary work around was to change the file paths on the server to be shorter in total length. Once the file paths were sufficiently short, the sync of these files works.

@mgallien
Copy link
Collaborator

mgallien commented Oct 9, 2024

@kmwoley I have a possible fox for this
already merged in stable branch
you can test this test build from the 3.14 stable branch
https://cloud.nextcloud.com/s/Pfw35DDoDWGnft2

@mgallien
Copy link
Collaborator

mgallien commented Oct 9, 2024

@kmwoley that was already reported in an older issue
closing this one as a duplicate
please provide your feedback on the other one if you can
duplicate: #7258

@mgallien mgallien closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confirmed bug approved by the team
Projects
None yet
Development

No branches or pull requests

2 participants