Review Request 112173: Do not use QFileInfo to obtain the size of a symlink in kio_trash
David Faure
faure at kde.org
Tue Aug 20 14:29:14 BST 2013
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/112173/#review38210
-----------------------------------------------------------
QFileInfo is more portable. Why not just write || info.isSymlink() in the first if?
kioslave/trash/discspaceutil.cpp
<http://git.reviewboard.kde.org/r/112173/#comment28235>
And if you really want to use stat, then this is a bit convoluted. No need to write a perfect isDir(), you're only using it in an "else" branch, i.e. you know that isFile() returned false already.
IMHO just else if (S_ISDIR(buff.st_mode)) would be simpler and easier to read.
(and folding isFile, too)
But anyway, QFileInfo can do the job just fine IMHO.
- David Faure
On Aug. 20, 2013, 1:22 p.m., Dawit Alemayehu wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/112173/
> -----------------------------------------------------------
>
> (Updated Aug. 20, 2013, 1:22 p.m.)
>
>
> Review request for KDE Runtime, David Faure and Tobias Koenig.
>
>
> Description
> -------
>
> The attached patch fixes a bug where deleting a symlink to a very large file causes a "trash has reached its limit error. This happens because the code that is used to determine the amount of space available in the trashcan uses QFileInfo::size to determine the size of a file. This will not work because QFileInfo::size returns the size of the actual file the symlink points to and not the size of the symlink itself. See the documentation for QFileInfo.
>
>
> This addresses bug 253776.
> http://bugs.kde.org/show_bug.cgi?id=253776
>
>
> Diffs
> -----
>
> kioslave/trash/discspaceutil.cpp 8e76ece
>
> Diff: http://git.reviewboard.kde.org/r/112173/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Dawit Alemayehu
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20130820/289f3849/attachment.htm>
More information about the kde-core-devel
mailing list