D25767: KAutoSaveFile: add a unit test to check max. filename length
Ahmad Samir
noreply at phabricator.kde.org
Thu Dec 5 16:59:31 GMT 2019
ahmadsamir created this revision.
ahmadsamir added reviewers: Frameworks, mpyne.
Herald added a project: Frameworks.
ahmadsamir requested review of this revision.
REVISION SUMMARY
In KAutoSaveFilePrivate::tempFile() the name of the kautosavefile that's
going to be created is generated using the filename and the absolute path
and some other bits (e.g. a string generated using KRandom). The problem
with that approach is that sometimes really long filenames can get created.
This unit test ensures that the checks in tempFile() work correctly and
generate filenames that don't exceed NAME_MAX (255 bytes/chars for Linux),
otherwise the files can't be opened.
Depends on D24489 <https://phabricator.kde.org/D24489>
References:
/usr/include/linux/limits.h
https://www.gnu.org/software/libc/manual/html_node/Limits-for-Files.html
https://www.kernel.org/doc/Documentation/filesystems/path-lookup.rst
TEST PLAN
- Running `ctest -R autosavefiletest` fails with current master
- Apply the patch from D24489 <https://phabricator.kde.org/D24489>, and the test should pass
REPOSITORY
R244 KCoreAddons
BRANCH
l-kautosave-unittest (branched from master)
REVISION DETAIL
https://phabricator.kde.org/D25767
AFFECTED FILES
autotests/kautosavefiletest.cpp
autotests/kautosavefiletest.h
To: ahmadsamir, #frameworks, mpyne
Cc: dfaure, kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20191205/7a1de2fe/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list