Gentoo Archives: gentoo-commits

From: Sergey Popov <pinkbyte@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/mhddfs/files/, sys-fs/mhddfs/
Date: Mon, 14 Jan 2019 09:46:26
Message-Id: 1547459152.8c316845267e069a89eb6c273de1233abcaa4cb6.pinkbyte@gentoo
1 commit: 8c316845267e069a89eb6c273de1233abcaa4cb6
2 Author: Sergey Popov <pinkbyte <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jan 14 09:43:33 2019 +0000
4 Commit: Sergey Popov <pinkbyte <AT> gentoo <DOT> org>
5 CommitDate: Mon Jan 14 09:45:52 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c316845
7
8 sys-fs/mhddfs: revision bump
9
10 Bump EAPI to 7. Fix segfault, use slotted sys-fs/fuse dependency
11 Committed straight to stable
12
13 Signed-off-by: Sergey Popov <pinkbyte <AT> gentoo.org>
14 Closes: https://bugs.gentoo.org/570992
15 Closes: https://bugs.gentoo.org/673644
16
17 Package-Manager: Portage-2.3.49, Repoman-2.3.10
18
19 .../mhddfs/files/mhddfs-0.1.39-segfault-fix.patch | 207 +++++++++++++++++++++
20 .../files/mhddfs-respect-compiler-vars.patch | 4 +-
21 ...hddfs-0.1.39.ebuild => mhddfs-0.1.39-r1.ebuild} | 21 ++-
22 3 files changed, 221 insertions(+), 11 deletions(-)
23
24 diff --git a/sys-fs/mhddfs/files/mhddfs-0.1.39-segfault-fix.patch b/sys-fs/mhddfs/files/mhddfs-0.1.39-segfault-fix.patch
25 new file mode 100644
26 index 00000000000..493a7839619
27 --- /dev/null
28 +++ b/sys-fs/mhddfs/files/mhddfs-0.1.39-segfault-fix.patch
29 @@ -0,0 +1,207 @@
30 +Patch backported from
31 +https://github.com/vdudouyt/mhddfs-nosegfault
32 +
33 +Thanks to Gabor Kovari <gabor.kovari@×××××.com>
34 +
35 +--- a/src/main.c 2012-06-17 16:09:56.000000000 +0200
36 ++++ b/src/main.c 2015-12-21 16:32:29.000000000 +0100
37 +@@ -33,6 +33,13 @@
38 + #include <sys/time.h>
39 + #include <utime.h>
40 +
41 ++#include <execinfo.h>
42 ++#include <signal.h>
43 ++#include <unistd.h>
44 ++
45 ++#include <glib.h>
46 ++#include <sys/resource.h>
47 ++
48 + #ifndef WITHOUT_XATTR
49 + #include <attr/xattr.h>
50 + #endif
51 +@@ -42,7 +49,21 @@
52 +
53 + #include "debug.h"
54 +
55 +-#include <uthash.h>
56 ++void save_backtrace(int sig)
57 ++{
58 ++ void *array[10];
59 ++ size_t size;
60 ++
61 ++ // get void*'s for all entries on the stack
62 ++ size = backtrace(array, 10);
63 ++
64 ++ // print out all the frames to stderr
65 ++ fprintf(stderr, "Error: signal %d\n", sig);
66 ++ FILE *log = fopen("/tmp/mhddfs_backtrace.log", "w");
67 ++ backtrace_symbols_fd(array, size, fileno(log));
68 ++ fclose(log);
69 ++ exit(1);
70 ++}
71 +
72 + // getattr
73 + static int mhdd_stat(const char *file_name, struct stat *buf)
74 +@@ -161,16 +182,13 @@
75 + mhdd_debug(MHDD_MSG, "mhdd_readdir: %s\n", dirname);
76 + char **dirs = (char **) calloc(mhdd.cdirs+1, sizeof(char *));
77 +
78 ++ struct stat st;
79 ++
80 + typedef struct dir_item {
81 + char *name;
82 + struct stat *st;
83 +- UT_hash_handle hh;
84 + } dir_item;
85 +
86 +- dir_item * items_ht = NULL;
87 +-
88 +-
89 +- struct stat st;
90 +
91 + // find all dirs
92 + for(i = j = found = 0; i<mhdd.cdirs; i++) {
93 +@@ -194,6 +212,8 @@
94 + return -errno;
95 + }
96 +
97 ++ GHashTable* hash = g_hash_table_new(g_str_hash, g_str_equal);
98 ++
99 + // read directories
100 + for (i = 0; dirs[i]; i++) {
101 + struct dirent *de;
102 +@@ -204,51 +224,43 @@
103 + while((de = readdir(dh))) {
104 + // find dups
105 +
106 +- struct dir_item *prev;
107 +-
108 +- HASH_FIND_STR(items_ht, de->d_name, prev);
109 +-
110 +- if (prev) {
111 ++ if(g_hash_table_lookup(hash, de->d_name))
112 ++ {
113 + continue;
114 + }
115 +
116 + // add item
117 + char *object_name = create_path(dirs[i], de->d_name);
118 +- struct dir_item *new_item =
119 +- calloc(1, sizeof(struct dir_item));
120 ++ struct dir_item *new_item = calloc(1, sizeof(struct dir_item));
121 +
122 + new_item->name = strdup(de->d_name);
123 + new_item->st = calloc(1, sizeof(struct stat));
124 + lstat(object_name, new_item->st);
125 +
126 +- HASH_ADD_KEYPTR(
127 +- hh,
128 +- items_ht,
129 +- new_item->name,
130 +- strlen(new_item->name),
131 +- new_item
132 +- );
133 ++ g_hash_table_insert(hash, new_item->name, new_item);
134 + free(object_name);
135 + }
136 +
137 + closedir(dh);
138 + }
139 +
140 +- dir_item *item, *tmp;
141 +-
142 +- // fill list
143 +- HASH_ITER(hh, items_ht, item, tmp) {
144 +- if (filler(buf, item->name, item->st, 0))
145 +- break;
146 +- }
147 ++ dir_item *item;
148 +
149 +- // free memory
150 +- HASH_ITER(hh, items_ht, item, tmp) {
151 ++ gpointer key, value;
152 ++ GHashTableIter iter;
153 ++ g_hash_table_iter_init(&iter, hash);
154 ++
155 ++ while(g_hash_table_iter_next (&iter, &key, &value))
156 ++ {
157 ++ item = (dir_item*) value;
158 ++ int result = filler(buf, item->name, item->st, 0);
159 + free(item->name);
160 + free(item->st);
161 + free(item);
162 ++ if(result) break;
163 + }
164 +- HASH_CLEAR(hh, items_ht);
165 ++
166 ++ g_hash_table_destroy(hash);
167 +
168 + for (i = 0; dirs[i]; i++)
169 + free(dirs[i]);
170 +@@ -1008,6 +1020,19 @@
171 + }
172 + #endif
173 +
174 ++static void limits_init()
175 ++{
176 ++ struct rlimit limit;
177 ++ limit.rlim_cur = 512000;
178 ++ limit.rlim_max = 512000;
179 ++
180 ++ if(setrlimit(RLIMIT_NOFILE, &limit) != 0)
181 ++ {
182 ++ perror("setrlimit() failed");
183 ++ exit(-1);
184 ++ }
185 ++}
186 ++
187 + // functions links
188 + static struct fuse_operations mhdd_oper = {
189 + .getattr = mhdd_stat,
190 +@@ -1048,5 +1073,7 @@
191 + mhdd_debug_init();
192 + struct fuse_args *args = parse_options(argc, argv);
193 + flist_init();
194 ++ limits_init();
195 ++ signal(SIGSEGV, save_backtrace);
196 + return fuse_main(args->argc, args->argv, &mhdd_oper, 0);
197 + }
198 +--- a/src/usage.c 2012-06-17 16:09:56.000000000 +0200
199 ++++ b/src/usage.c 2015-12-21 16:32:29.000000000 +0100
200 +@@ -25,6 +25,7 @@
201 + "\n"
202 + "Multi-hdd FUSE filesystem\n"
203 + " Copyright (C) 2008, Dmitry E. Oboukhov <dimka@××××××.org>\n"
204 ++ " Copyright (C) 2015, Valentin Dudouyt <valentin.dudouyt@×××××.com>\n"
205 + "\n"
206 + "Usage:\n"
207 + " mhddfs dir1,dir2.. mountpoint [ -o OPTIONS ]\n"
208 +--- a/Makefile 2016-01-05 16:45:10.184105001 +0100
209 ++++ b/Makefile 2015-12-21 16:32:29.000000000 +0100
210 +@@ -22,13 +22,13 @@
211 +
212 + TARGET = mhddfs
213 +
214 +-CFLAGS += -Wall $(shell pkg-config fuse --cflags) \
215 +- -DFUSE_USE_VERSION=26 -MMD
216 ++CFLAGS = -Wall $(shell pkg-config fuse glib-2.0 --cflags) \
217 ++ -DFUSE_USE_VERSION=26 -MMD -g -rdynamic -O0
218 + ifdef WITHOUT_XATTR
219 + CFLAGS += -DWITHOUT_XATTR
220 + endif
221 +
222 +-LIBS = $(shell pkg-config fuse --libs)
223 ++LDFLAGS = $(shell pkg-config fuse glib-2.0 --libs)
224 +
225 + FORTAR = src COPYING LICENSE README Makefile \
226 + README.ru.UTF-8 ChangeLog mhddfs.1 \
227 +@@ -53,7 +53,7 @@
228 + ifeq ($(DEBVERSION), $(VERSION))
229 + all: $(TARGET)
230 + else
231 +-all: update_version $(TARGET)
232 ++all: $(TARGET)
233 + endif
234 +
235 + update_version:
236 +
237
238 diff --git a/sys-fs/mhddfs/files/mhddfs-respect-compiler-vars.patch b/sys-fs/mhddfs/files/mhddfs-respect-compiler-vars.patch
239 index 331bb7c23f6..0c6f24f4d1a 100644
240 --- a/sys-fs/mhddfs/files/mhddfs-respect-compiler-vars.patch
241 +++ b/sys-fs/mhddfs/files/mhddfs-respect-compiler-vars.patch
242 @@ -1,5 +1,5 @@
243 ---- Makefile.orig 2012-11-19 15:25:21.665692111 +0400
244 -+++ Makefile 2012-11-19 15:27:08.406691288 +0400
245 +--- a/Makefile 2012-11-19 15:25:21.665692111 +0400
246 ++++ b/Makefile 2012-11-19 15:27:08.406691288 +0400
247 @@ -22,13 +22,13 @@
248
249 TARGET = mhddfs
250
251 diff --git a/sys-fs/mhddfs/mhddfs-0.1.39.ebuild b/sys-fs/mhddfs/mhddfs-0.1.39-r1.ebuild
252 similarity index 75%
253 rename from sys-fs/mhddfs/mhddfs-0.1.39.ebuild
254 rename to sys-fs/mhddfs/mhddfs-0.1.39-r1.ebuild
255 index 79fe6fb79f8..f161e79fa0f 100644
256 --- a/sys-fs/mhddfs/mhddfs-0.1.39.ebuild
257 +++ b/sys-fs/mhddfs/mhddfs-0.1.39-r1.ebuild
258 @@ -1,9 +1,9 @@
259 -# Copyright 1999-2016 Gentoo Foundation
260 +# Copyright 1999-2019 Gentoo Foundation
261 # Distributed under the terms of the GNU General Public License v2
262
263 -EAPI=4
264 +EAPI=7
265
266 -inherit base eutils toolchain-funcs
267 +inherit toolchain-funcs
268
269 MY_P="${PN}_${PV}"
270
271 @@ -14,14 +14,17 @@ SRC_URI="http://mhddfs.uvw.ru/downloads/${MY_P}.tar.gz"
272 LICENSE="GPL-3"
273 SLOT="0"
274 KEYWORDS="amd64"
275 +
276 IUSE="l10n_ru suid"
277
278 -RDEPEND=">=sys-fs/fuse-2.7.0"
279 -DEPEND="${RDEPEND}
280 - dev-libs/uthash"
281 +RDEPEND="sys-fs/fuse:0"
282 +DEPEND="${RDEPEND}"
283
284 -DOCS="ChangeLog README"
285 -PATCHES=( "${FILESDIR}/${PN}-respect-compiler-vars.patch" )
286 +DOCS=( ChangeLog README )
287 +PATCHES=(
288 + "${FILESDIR}/${PN}-respect-compiler-vars.patch"
289 + "${FILESDIR}/${P}-segfault-fix.patch"
290 +)
291
292 src_compile() {
293 emake CC="$(tc-getCC)"
294 @@ -30,7 +33,7 @@ src_compile() {
295 src_install() {
296 dobin mhddfs
297 doman mhddfs.1
298 - dodoc ${DOCS}
299 + einstalldocs
300 use l10n_ru && dodoc README.ru.UTF-8
301 use suid && fperms u+s /usr/bin/${PN}
302 }