1 |
commit: d8ac254024baa255a225d915ce28b48dbd339985 |
2 |
Author: Luis Ressel <aranea <AT> aixah <DOT> de> |
3 |
AuthorDate: Thu Jan 10 16:54:46 2019 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jan 11 15:09:35 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=d8ac2540 |
7 |
|
8 |
Patch i3status to remove uses of GLOB_TILDE |
9 |
|
10 |
* Reimplement resolve_tilde(). The new impl isn't quite equivalent, but |
11 |
since this function is only used internally, I don't see why using |
12 |
glob() would be neccessary. |
13 |
* Define GLOB_TILDE=0 to fix the other two sites which use it. They |
14 |
process user-provided paths and only use GLOB_TILDE for convenience, |
15 |
so it can be disabled. |
16 |
|
17 |
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org> |
18 |
|
19 |
.../i3status/files/i3status-2.12-glob_tilde.patch | 59 ++++++++++++++++++++++ |
20 |
x11-misc/i3status/i3status-2.12.ebuild | 2 +- |
21 |
2 files changed, 60 insertions(+), 1 deletion(-) |
22 |
|
23 |
diff --git a/x11-misc/i3status/files/i3status-2.12-glob_tilde.patch b/x11-misc/i3status/files/i3status-2.12-glob_tilde.patch |
24 |
new file mode 100644 |
25 |
index 0000000..b1f2ba6 |
26 |
--- /dev/null |
27 |
+++ b/x11-misc/i3status/files/i3status-2.12-glob_tilde.patch |
28 |
@@ -0,0 +1,59 @@ |
29 |
+diff --git i/i3status.c w/i3status.c |
30 |
+index 5088c96..3c18214 100644 |
31 |
+--- i/i3status.c |
32 |
++++ w/i3status.c |
33 |
+@@ -210,29 +210,19 @@ static int valid_color(const char *value) { |
34 |
+ * |
35 |
+ */ |
36 |
+ static char *resolve_tilde(const char *path) { |
37 |
+- static glob_t globbuf; |
38 |
+- char *head, *tail, *result = NULL; |
39 |
+- |
40 |
+- tail = strchr(path, '/'); |
41 |
+- head = strndup(path, tail ? (size_t)(tail - path) : strlen(path)); |
42 |
+- |
43 |
+- int res = glob(head, GLOB_TILDE, NULL, &globbuf); |
44 |
+- free(head); |
45 |
+- /* no match, or many wildcard matches are bad */ |
46 |
+- if (res == GLOB_NOMATCH || globbuf.gl_pathc != 1) |
47 |
+- result = sstrdup(path); |
48 |
+- else if (res != 0) { |
49 |
+- die("glob() failed"); |
50 |
+- } else { |
51 |
+- head = globbuf.gl_pathv[0]; |
52 |
+- result = scalloc(strlen(head) + (tail ? strlen(tail) : 0) + 1); |
53 |
+- strncpy(result, head, strlen(head)); |
54 |
+- if (tail) |
55 |
+- strncat(result, tail, strlen(tail)); |
56 |
++ char *home, *result = NULL; |
57 |
++ |
58 |
++ if (strncmp(path, "~/", 2) == 0) { |
59 |
++ home = getenv("HOME"); |
60 |
++ if (home != NULL) { |
61 |
++ result = scalloc(strlen(home) + strlen(path)); |
62 |
++ strcpy(result, home); |
63 |
++ strcat(result, path+1); |
64 |
++ return result; |
65 |
++ } |
66 |
+ } |
67 |
+- globfree(&globbuf); |
68 |
+ |
69 |
+- return result; |
70 |
++ return sstrdup(path); |
71 |
+ } |
72 |
+ |
73 |
+ static char *get_config_path(void) { |
74 |
+diff --git i/include/i3status.h w/include/i3status.h |
75 |
+index 9ac471d..27ecae4 100644 |
76 |
+--- i/include/i3status.h |
77 |
++++ w/include/i3status.h |
78 |
+@@ -236,4 +236,9 @@ extern cfg_t *cfg, *cfg_general, *cfg_section; |
79 |
+ extern void **cur_instance; |
80 |
+ |
81 |
+ extern pthread_t main_thread; |
82 |
++ |
83 |
++#ifndef GLOB_TILDE |
84 |
++#define GLOB_TILDE 0 |
85 |
++#endif |
86 |
++ |
87 |
+ #endif |
88 |
|
89 |
diff --git a/x11-misc/i3status/i3status-2.12.ebuild b/x11-misc/i3status/i3status-2.12.ebuild |
90 |
index 81f9ba7..2d8020a 100644 |
91 |
--- a/x11-misc/i3status/i3status-2.12.ebuild |
92 |
+++ b/x11-misc/i3status/i3status-2.12.ebuild |
93 |
@@ -24,7 +24,7 @@ DEPEND=" |
94 |
" |
95 |
RDEPEND="${DEPEND}" |
96 |
|
97 |
-PATCHES=( "${FILESDIR}"/${PN}-2.11-pulseaudio.patch ) |
98 |
+PATCHES=( "${FILESDIR}"/${PN}-2.11-pulseaudio.patch "${FILESDIR}"/${PN}-2.12-glob_tilde.patch ) |
99 |
|
100 |
src_prepare() { |
101 |
default |