Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: kde-frameworks/kcoreaddons/, kde-frameworks/kcoreaddons/files/
Date: Sun, 18 Nov 2018 09:37:24
Message-Id: 1542533814.e5d5b6474794bf4cab01a184fc86b2d90529077f.asturm@gentoo
1 commit: e5d5b6474794bf4cab01a184fc86b2d90529077f
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Sun Nov 18 09:33:41 2018 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Sun Nov 18 09:36:54 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5d5b647
7
8 kde-frameworks/kcoreaddons: Fix crash if XDG_CACHE_HOME is too small
9
10 KDE-bug: https://bugs.kde.org/show_bug.cgi?id=400610
11 Reported-by: Mike <bugs <AT> ubhofmann.de>
12 Package-Manager: Portage-2.3.51, Repoman-2.3.12
13 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
14
15 ...ddons-5.52.0-xdg_cache_home-nospace-crash.patch | 54 ++++++++++++++++++++++
16 .../kcoreaddons/kcoreaddons-5.52.0-r1.ebuild | 41 ++++++++++++++++
17 2 files changed, 95 insertions(+)
18
19 diff --git a/kde-frameworks/kcoreaddons/files/kcoreaddons-5.52.0-xdg_cache_home-nospace-crash.patch b/kde-frameworks/kcoreaddons/files/kcoreaddons-5.52.0-xdg_cache_home-nospace-crash.patch
20 new file mode 100644
21 index 00000000000..7b1a7965292
22 --- /dev/null
23 +++ b/kde-frameworks/kcoreaddons/files/kcoreaddons-5.52.0-xdg_cache_home-nospace-crash.patch
24 @@ -0,0 +1,54 @@
25 +From eb916c305a5cd8683e7e8f955740a7c810220e19 Mon Sep 17 00:00:00 2001
26 +From: Alexey Min <alexey.min@×××××.com>
27 +Date: Thu, 8 Nov 2018 00:28:30 +0300
28 +Subject: Fix crash if XDG_CACHE_HOME directory is too small or out of space
29 +
30 +Summary:
31 +Incorrect checking for error return code of posix_fallocate() causes function to think that everything is OK, while it is not, causing crash in some cases.
32 +
33 +BUG: 400610
34 +CCBUG: 339829
35 +
36 +Test Plan:
37 +good test plan provided in https://bugs.kde.org/show_bug.cgi?id=400610 . Works like a charm, tested in KDE Neon dev-ustable
38 +
39 +The reason for bug was that return value of posix_fallocate() was assumed to be negative on error, but in fact it is a positive integer. The check was `< 0`, whi should be `!= 0`. ( http://man7.org/linux/man-pages/man3/posix_fallocate.3.html )
40 +
41 +With this fix applied test application does not crash, and the output in console widow is:
42 +```
43 +No space left on device. Check filesystem free space at your XDG_CACHE_HOME!
44 +The operating system is unable to promise 10547304 bytes for mapped cache, abandoning the cache for crash-safety.
45 +org.kde.kcoreaddons: Failed to establish shared memory mapping, will fallback to private memory -- memory usage will increase
46 +```
47 +
48 +Reviewers: dfaure, #frameworks, mpyne
49 +
50 +Reviewed By: dfaure
51 +
52 +Subscribers: cfeck, kde-frameworks-devel
53 +
54 +Tags: #frameworks
55 +
56 +Differential Revision: https://phabricator.kde.org/D16744
57 +---
58 + src/lib/caching/kshareddatacache_p.h | 5 ++++-
59 + 1 file changed, 4 insertions(+), 1 deletion(-)
60 +
61 +diff --git a/src/lib/caching/kshareddatacache_p.h b/src/lib/caching/kshareddatacache_p.h
62 +index 625bc5d..c13275b 100644
63 +--- a/src/lib/caching/kshareddatacache_p.h
64 ++++ b/src/lib/caching/kshareddatacache_p.h
65 +@@ -472,7 +472,10 @@ static bool ensureFileAllocated(int fd, size_t fileSize)
66 + ;
67 + }
68 +
69 +- if (result < 0) {
70 ++ if (result != 0) {
71 ++ if (result == ENOSPC) {
72 ++ qCritical() << "No space left on device. Check filesystem free space at your XDG_CACHE_HOME!";
73 ++ }
74 + qCritical() << "The operating system is unable to promise"
75 + << fileSize
76 + << "bytes for mapped cache, "
77 +--
78 +cgit v0.11.2
79
80 diff --git a/kde-frameworks/kcoreaddons/kcoreaddons-5.52.0-r1.ebuild b/kde-frameworks/kcoreaddons/kcoreaddons-5.52.0-r1.ebuild
81 new file mode 100644
82 index 00000000000..af442d38971
83 --- /dev/null
84 +++ b/kde-frameworks/kcoreaddons/kcoreaddons-5.52.0-r1.ebuild
85 @@ -0,0 +1,41 @@
86 +# Copyright 1999-2018 Gentoo Authors
87 +# Distributed under the terms of the GNU General Public License v2
88 +
89 +EAPI=6
90 +
91 +inherit kde5
92 +
93 +DESCRIPTION="Framework for solving common problems such as caching, randomisation, and more"
94 +LICENSE="LGPL-2+"
95 +KEYWORDS="~amd64 ~arm ~arm64 ~x86"
96 +IUSE="fam nls"
97 +
98 +RDEPEND="
99 + $(add_qt_dep qtcore 'icu')
100 + fam? ( virtual/fam )
101 +"
102 +DEPEND="${RDEPEND}
103 + x11-misc/shared-mime-info
104 + nls? ( $(add_qt_dep linguist-tools) )
105 +"
106 +
107 +PATCHES=( "${FILESDIR}/${P}-xdg_cache_home-nospace-crash.patch" )
108 +
109 +src_configure() {
110 + local mycmakeargs=(
111 + -D_KDE4_DEFAULT_HOME_POSTFIX=4
112 + $(cmake-utils_use_find_package fam FAM)
113 + )
114 +
115 + kde5_src_configure
116 +}
117 +
118 +src_test() {
119 + # bugs: 619656, 632398, 647414, 665682
120 + local myctestargs=(
121 + -j1
122 + -E "(kautosavefiletest|kdirwatch_qfswatch_unittest|kformattest)"
123 + )
124 +
125 + kde5_src_test
126 +}