[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-frameworks-devel
Subject:    D25767: KAutoSaveFile: add a unit test to check max. filename length
From:       Ahmad Samir <noreply () phabricator ! kde ! org>
Date:       2019-12-05 16:59:31
Message-ID: 9ac08c0a43895071c42a0fa3f271dfd8 () localhost ! localdomain
[Download RAW message or body]

[Attachment #2 (text/plain)]

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

[Attachment #3 (text/html)]

<table><tr><td style="">ahmadsamir created this revision.<br />ahmadsamir added \
reviewers: Frameworks, mpyne.<br />Herald added a project: Frameworks.<br \
/>ahmadsamir requested review of this revision. </td><a style="text-decoration: none; \
padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; \
border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to \
bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" \
href="https://phabricator.kde.org/D25767">View Revision</a></tr></table><br \
/><div><strong>REVISION SUMMARY</strong><div><p>In KAutoSaveFilePrivate::tempFile() \
the name of the kautosavefile that&#039;s<br /> going to be created is generated \
using the filename and the absolute path<br /> and some other bits (e.g. a string \
generated using KRandom). The problem<br /> with that approach is that sometimes \
really long filenames can get created.<br /> This unit test ensures that the checks \
in tempFile() work correctly and<br /> generate filenames that don&#039;t exceed \
NAME_MAX (255 bytes/chars for Linux),<br /> otherwise the files can&#039;t be \
opened.</p>

<p>Depends on <a href="https://phabricator.kde.org/D24489" style="background-color: \
#e7e7e7;  border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">D24489</a></p>

<p>References:<br />
/usr/include/linux/limits.h<br />
<a href="https://www.gnu.org/software/libc/manual/html_node/Limits-for-Files.html" \
class="remarkup-link" target="_blank" \
rel="noreferrer">https://www.gnu.org/software/libc/manual/html_node/Limits-for-Files.html</a><br \
/> <a href="https://www.kernel.org/doc/Documentation/filesystems/path-lookup.rst" \
class="remarkup-link" target="_blank" \
rel="noreferrer">https://www.kernel.org/doc/Documentation/filesystems/path-lookup.rst</a></p></div></div><br \
/><div><strong>TEST PLAN</strong><div><ul class="remarkup-list"> <li \
class="remarkup-list-item">Running <tt style="background: #ebebeb; font-size: \
13px;">ctest -R autosavefiletest</tt> fails with current master</li> <li \
class="remarkup-list-item">Apply the patch from <a \
href="https://phabricator.kde.org/D24489" style="background-color: #e7e7e7;  \
border-color: #e7e7e7;  border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">D24489</a>, and the test should \
pass</li> </ul></div></div><br /><div><strong>REPOSITORY</strong><div><div>R244 \
KCoreAddons</div></div></div><br \
/><div><strong>BRANCH</strong><div><div>l-kautosave-unittest (branched from \
master)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a \
href="https://phabricator.kde.org/D25767">https://phabricator.kde.org/D25767</a></div></div><br \
/><div><strong>AFFECTED FILES</strong><div><div>autotests/kautosavefiletest.cpp<br /> \
autotests/kautosavefiletest.h</div></div></div><br /><div><strong>To: \
</strong>ahmadsamir, Frameworks, mpyne<br /><strong>Cc: </strong>dfaure, \
kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns<br /></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic