Bug 412519

Summary: Spammed by "Cannot create autosave file" error messages
Product: [Frameworks and Libraries] frameworks-kcoreaddons Reporter: Alexander Meshcheryakov <alexander.s.m>
Component: generalAssignee: Michael Pyne <mpyne>
Status: RESOLVED FIXED    
Severity: major CC: jb, kdelibs-bugs
Priority: NOR    
Version: 5.62.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Alexander Meshcheryakov 2019-10-01 20:16:47 UTC
SUMMARY
Autosave does not work if project is placed in directory with long path to that directory, especially if it contains national alphabet characters.

STEPS TO REPRODUCE
1. Create directory '/tmp/Поддержка национальных алфавитов? Слишком сложно!'
2. Save project there as "project.kdenlive"
3. Fiddle with project a bit to let Kdenlive notice that there are unsaved changes that might be lost

OBSERVED RESULT
You will every minute or so get error message "Cannot create autosave file $HOME/.local/share/stalefiles/kdenlive/VERYLONGSTRING"

EXPECTED RESULT
Well, user should not be pestered with error messages.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.16.5
KDE Frameworks Version: 5.61.0
Qt Version: 5.13.1

ADDITIONAL INFORMATION
According to my tests autosave file is named by pattern "$hash" + "$url_encoded_path_to_project_dir" + "$a_bit_more_chars". These scheme easily produces really long filenames! Because filenames under GNU/Linux has to fit in 255 bytes, scheme leads to inability to save file and error messages.

This is especially common problem if one uses national characters in directory path. For instance russian "Я" becomes "%D0%AF" - 6 bytes, 3x times more than it takes in original directory path, where project resides.
Comment 1 Jean-Baptiste Mardelle 2019-10-07 11:18:09 UTC
Thanks for your report. This is in fact a bug in KAutoSaveFile, part of KDE's framework KCoreAddons.
It doesn't correctly limit the autosave filename to 255 characters, as imposed by most file systems. I will propose a patch for that soon.
Comment 2 Jean-Baptiste Mardelle 2019-10-08 11:17:48 UTC
Proposed patch is here:
https://phabricator.kde.org/D24489
Comment 3 Jean-Baptiste Mardelle 2019-12-13 15:06:19 UTC
Git commit 46e464d85767603b5f2e53d95d40113de1b2fd42 by Jean-Baptiste Mardelle.
Committed on 13/12/2019 at 15:04.
Pushed by mardelle into branch 'master'.

Fix KAutoSaveFile broken on long path
Differential revision: https://phabricator.kde.org/D24489

M  +32   -12   src/lib/io/kautosavefile.cpp

https://commits.kde.org/kcoreaddons/46e464d85767603b5f2e53d95d40113de1b2fd42