1 |
commit: fde763b85279eb554bd97c62a130ddad460956b1 |
2 |
Author: Daniel Pielmeier <billie <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 1 10:45:29 2020 +0000 |
4 |
Commit: Daniel Pielmeier <billie <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 1 10:45:29 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fde763b8 |
7 |
|
8 |
sys-fs/fatsort: Fix bug #707726 building with -fno-common. |
9 |
|
10 |
Thanks to Toralf Förster for the report. |
11 |
|
12 |
Package-Manager: Portage-2.3.89, Repoman-2.3.20 |
13 |
Signed-off-by: Daniel Pielmeier <billie <AT> gentoo.org> |
14 |
|
15 |
sys-fs/fatsort/fatsort-1.5.0.ebuild | 6 +- |
16 |
sys-fs/fatsort/fatsort-1.6.2.605.ebuild | 4 + |
17 |
sys-fs/fatsort/files/fatsort-1.5.0-gcc10.patch | 12 + |
18 |
sys-fs/fatsort/files/fatsort-1.6.2.605-gcc10.patch | 256 +++++++++++++++++++++ |
19 |
4 files changed, 277 insertions(+), 1 deletion(-) |
20 |
|
21 |
diff --git a/sys-fs/fatsort/fatsort-1.5.0.ebuild b/sys-fs/fatsort/fatsort-1.5.0.ebuild |
22 |
index 73df445b94e..d677a51ab6d 100644 |
23 |
--- a/sys-fs/fatsort/fatsort-1.5.0.ebuild |
24 |
+++ b/sys-fs/fatsort/fatsort-1.5.0.ebuild |
25 |
@@ -1,4 +1,4 @@ |
26 |
-# Copyright 1999-2019 Gentoo Authors |
27 |
+# Copyright 1999-2020 Gentoo Authors |
28 |
# Distributed under the terms of the GNU General Public License v2 |
29 |
|
30 |
EAPI=7 |
31 |
@@ -18,6 +18,10 @@ KEYWORDS="amd64 x86" |
32 |
|
33 |
S=${WORKDIR}/${MY_P} |
34 |
|
35 |
+PATCHES=( |
36 |
+ "${FILESDIR}/${PN}-1.5.0-gcc10.patch" |
37 |
+) |
38 |
+ |
39 |
src_prepare() { |
40 |
default |
41 |
|
42 |
|
43 |
diff --git a/sys-fs/fatsort/fatsort-1.6.2.605.ebuild b/sys-fs/fatsort/fatsort-1.6.2.605.ebuild |
44 |
index e80f5c53a7f..9fefbf5330a 100644 |
45 |
--- a/sys-fs/fatsort/fatsort-1.6.2.605.ebuild |
46 |
+++ b/sys-fs/fatsort/fatsort-1.6.2.605.ebuild |
47 |
@@ -13,6 +13,10 @@ LICENSE="GPL-2" |
48 |
SLOT="0" |
49 |
KEYWORDS="~amd64 ~x86" |
50 |
|
51 |
+PATCHES=( |
52 |
+ "${FILESDIR}/${P}-gcc10.patch" |
53 |
+) |
54 |
+ |
55 |
src_prepare() { |
56 |
default |
57 |
|
58 |
|
59 |
diff --git a/sys-fs/fatsort/files/fatsort-1.5.0-gcc10.patch b/sys-fs/fatsort/files/fatsort-1.5.0-gcc10.patch |
60 |
new file mode 100644 |
61 |
index 00000000000..c334793f11d |
62 |
--- /dev/null |
63 |
+++ b/sys-fs/fatsort/files/fatsort-1.5.0-gcc10.patch |
64 |
@@ -0,0 +1,12 @@ |
65 |
+--- a/src/options.h |
66 |
++++ b/src/options.h |
67 |
+@@ -35,7 +35,7 @@ |
68 |
+ extern struct sStringList *OPT_INCL_DIRS, *OPT_EXCL_DIRS, *OPT_INCL_DIRS_REC, *OPT_EXCL_DIRS_REC, *OPT_IGNORE_PREFIXES_LIST; |
69 |
+ extern struct sRegExList *OPT_REGEX_INCL, *OPT_REGEX_EXCL; |
70 |
+ |
71 |
+-char *OPT_LOCALE; |
72 |
++extern char *OPT_LOCALE; |
73 |
+ |
74 |
+ // parses command line options |
75 |
+ int32_t parse_options(int argc, char *argv[]); |
76 |
+ |
77 |
|
78 |
diff --git a/sys-fs/fatsort/files/fatsort-1.6.2.605-gcc10.patch b/sys-fs/fatsort/files/fatsort-1.6.2.605-gcc10.patch |
79 |
new file mode 100644 |
80 |
index 00000000000..0446fe3e09d |
81 |
--- /dev/null |
82 |
+++ b/sys-fs/fatsort/files/fatsort-1.6.2.605-gcc10.patch |
83 |
@@ -0,0 +1,256 @@ |
84 |
+Index: tests/Makefile |
85 |
+=================================================================== |
86 |
+--- a/tests/Makefile (revision 606) |
87 |
++++ b/tests/Makefile (revision 613) |
88 |
+@@ -19,7 +19,7 @@ |
89 |
+ if [ ! -f $$i/passed ]; then \ |
90 |
+ printf "%.70s" "Test case $$i... "; \ |
91 |
+ printf "[ \e[1;33mWAIT \e[0m]"; \ |
92 |
+- ${MAKE} -C $$i &>> /dev/null; \ |
93 |
++ ${MAKE} -C $$i &> /dev/null; \ |
94 |
+ ret=$$?; \ |
95 |
+ printf "\r%.70s" "Test case $$i... "; \ |
96 |
+ if [ $$ret -eq 0 ]; then \ |
97 |
+Index: CHANGES.md |
98 |
+=================================================================== |
99 |
+--- a/CHANGES.md (revision 606) |
100 |
++++ b/CHANGES.md (revision 613) |
101 |
+@@ -1,5 +1,11 @@ |
102 |
+ # Changelog |
103 |
+ |
104 |
++## v1.6.3 (xxx) |
105 |
++* fixed support for macOS (thanks to Max for the fix) |
106 |
++* declared OPT_LOCALE as extern |
107 |
++* fixed uninitialized variable |
108 |
++* avoided some string truncation compiler warnings |
109 |
++ |
110 |
+ ## v1.6.2 (November 29, 2019) |
111 |
+ - FIX: multiple endianness issues with exFAT |
112 |
+ - now using /proc/self/mounts instead of /etc/mtab to check whether filesystem is mounted |
113 |
+Index: src/FAT_fs.c |
114 |
+=================================================================== |
115 |
+--- a/src/FAT_fs.c (revision 606) |
116 |
++++ b/src/FAT_fs.c (revision 613) |
117 |
+@@ -42,7 +42,7 @@ |
118 |
+ // used to check if device is mounted |
119 |
+ #if defined(__LINUX__) |
120 |
+ #include <mntent.h> |
121 |
+-#elif defined (__BSD__) |
122 |
++#elif defined (__BSD__) || defined (__OSX__) |
123 |
+ #include <sys/ucred.h> |
124 |
+ #include <sys/mount.h> |
125 |
+ #endif |
126 |
+@@ -85,7 +85,7 @@ |
127 |
+ |
128 |
+ return ret; |
129 |
+ |
130 |
+-#elif defined(__BSD__) |
131 |
++#elif defined(__BSD__) || defined(__OSX__) |
132 |
+ struct statfs *mntbuf; |
133 |
+ int i, mntsize; |
134 |
+ int32_t ret = 0; |
135 |
+Index: src/deviceio.c |
136 |
+=================================================================== |
137 |
+--- a/src/deviceio.c (revision 606) |
138 |
++++ b/src/deviceio.c (revision 613) |
139 |
+@@ -24,7 +24,7 @@ |
140 |
+ |
141 |
+ #include "deviceio.h" |
142 |
+ |
143 |
+-#if defined __LINUX__ || defined __BSD__ |
144 |
++#if defined __LINUX__ || defined __BSD__ || defined __OSX__ |
145 |
+ |
146 |
+ #include <sys/types.h> |
147 |
+ #include <sys/stat.h> |
148 |
+@@ -59,7 +59,7 @@ |
149 |
+ #include "mallocv.h" |
150 |
+ #include "errors.h" |
151 |
+ |
152 |
+-#if defined __LINUX__ || defined __BSD__ |
153 |
++#if defined __LINUX__ || defined __BSD__ || defined __OSX__ |
154 |
+ |
155 |
+ DEVICE *device_open(const char *path) { |
156 |
+ |
157 |
+@@ -88,7 +88,7 @@ |
158 |
+ assert(device != NULL); |
159 |
+ assert(offset >= 0); |
160 |
+ |
161 |
+-#if defined __BSD__ |
162 |
++#if defined __BSD__ || defined __OSX__ |
163 |
+ return lseek(device->fd, (off_t) offset, SEEK_SET); |
164 |
+ #else |
165 |
+ return lseek64(device->fd, (off64_t) offset, SEEK_SET); |
166 |
+Index: src/deviceio.h |
167 |
+=================================================================== |
168 |
+--- a/src/deviceio.h (revision 606) |
169 |
++++ b/src/deviceio.h (revision 613) |
170 |
+@@ -27,7 +27,7 @@ |
171 |
+ |
172 |
+ #include <stdint.h> |
173 |
+ |
174 |
+-#if defined __LINUX__ || defined __BSD__ |
175 |
++#if defined __LINUX__ || defined __BSD__ || defined __OSX__ |
176 |
+ |
177 |
+ #define DIRECTORY_SEPARATOR '/' |
178 |
+ |
179 |
+Index: src/fatsort.c |
180 |
+=================================================================== |
181 |
+--- a/src/fatsort.c (revision 606) |
182 |
++++ b/src/fatsort.c (revision 613) |
183 |
+@@ -45,7 +45,7 @@ |
184 |
+ |
185 |
+ // program information |
186 |
+ #define INFO_PROGRAM "fatsort" |
187 |
+-#define INFO_VERSION "1.6.2" |
188 |
++#define INFO_VERSION "1.6.3" |
189 |
+ #define INFO_AUTHOR "Written by Boris Leidner.\n" |
190 |
+ #define INFO_COPYRIGHT "Copyright (C) 2004-2019 Boris Leidner.\n" |
191 |
+ #define INFO_LICENSE "License GPLv2: GNU GPL version 2 (see LICENSE.txt)\n" \ |
192 |
+Index: src/sort.c |
193 |
+=================================================================== |
194 |
+--- a/src/sort.c (revision 606) |
195 |
++++ b/src/sort.c (revision 613) |
196 |
+@@ -261,14 +261,15 @@ |
197 |
+ |
198 |
+ struct sExFATDirEntry de; |
199 |
+ struct sExFATDirEntrySet *des; |
200 |
+- struct sExFATDirEntryList *del; |
201 |
++ struct sExFATDirEntryList *del=NULL; |
202 |
+ |
203 |
+ char name[MAX_PATH_LEN+1]; |
204 |
+- char str[32]; |
205 |
++ char str[31]; |
206 |
+ char *outptr, *inptr; |
207 |
+ uint8_t nameLength=0; |
208 |
+ |
209 |
+- size_t outcount, incount, iret; |
210 |
++ size_t outcount=30; |
211 |
++ size_t incount, iret; |
212 |
+ |
213 |
+ *direntrysets=0; |
214 |
+ |
215 |
+@@ -376,7 +377,7 @@ |
216 |
+ } |
217 |
+ outptr[0]='\0'; |
218 |
+ |
219 |
+- strncat(name, str, 30); |
220 |
++ strncat(name, str, 31); |
221 |
+ |
222 |
+ // we are done here |
223 |
+ if (entries == expected_entries) { |
224 |
+@@ -512,7 +513,7 @@ |
225 |
+ union sDirEntry de; |
226 |
+ struct sDirEntryList *lnde; |
227 |
+ struct sLongDirEntryList *llist; |
228 |
+- char tmp[MAX_PATH_LEN+1], dummy[MAX_PATH_LEN*2+1], sname[MAX_PATH_LEN+1], lname[MAX_PATH_LEN+1]; |
229 |
++ char tmp[MAX_PATH_LEN+1], dummy[MAX_PATH_LEN+1], sname[MAX_PATH_LEN+1], lname[MAX_PATH_LEN+1]; |
230 |
+ |
231 |
+ *direntries=0; |
232 |
+ |
233 |
+@@ -589,8 +590,11 @@ |
234 |
+ return -1; |
235 |
+ } |
236 |
+ |
237 |
+- snprintf(dummy, MAX_PATH_LEN*2+1, "%s%s", tmp, lname); |
238 |
+- strncpy(lname, dummy, MAX_PATH_LEN); |
239 |
++ strncpy(dummy, tmp, MAX_PATH_LEN); |
240 |
++ dummy[MAX_PATH_LEN]='\0'; |
241 |
++ strncat(dummy, lname, MAX_PATH_LEN - strlen(dummy)); |
242 |
++ dummy[MAX_PATH_LEN]='\0'; |
243 |
++ strncpy(lname, dummy, MAX_PATH_LEN+1); |
244 |
+ |
245 |
+ break; |
246 |
+ default: |
247 |
+@@ -708,8 +712,8 @@ |
248 |
+ dummy[MAX_PATH_LEN]='\0'; |
249 |
+ strncat(dummy, lname, MAX_PATH_LEN - strlen(dummy)); |
250 |
+ dummy[MAX_PATH_LEN]='\0'; |
251 |
+- strncpy(lname, dummy, MAX_PATH_LEN); |
252 |
+- dummy[MAX_PATH_LEN]='\0'; |
253 |
++ strncpy(lname, dummy, MAX_PATH_LEN+1); |
254 |
++ //dummy[MAX_PATH_LEN]='\0'; |
255 |
+ break; |
256 |
+ default: |
257 |
+ myerror("Unhandled return code!"); |
258 |
+Index: src/options.c |
259 |
+=================================================================== |
260 |
+--- a/src/options.c (revision 606) |
261 |
++++ b/src/options.c (revision 613) |
262 |
+@@ -55,7 +55,6 @@ |
263 |
+ assert(stringList != NULL); |
264 |
+ assert(stringList->str == NULL); |
265 |
+ assert(str != NULL); |
266 |
+- assert(strlen((char *)str) <= MAX_PATH_LEN); |
267 |
+ |
268 |
+ char *newStr; |
269 |
+ |
270 |
+@@ -77,14 +76,16 @@ |
271 |
+ // copy string to new structure including missing slashes |
272 |
+ newStr[0] = '\0'; |
273 |
+ if (prefix) newStr[0] = DIRECTORY_SEPARATOR; |
274 |
+- strncat(newStr, (const char*) str, len); |
275 |
++ memcpy(newStr+prefix, (const char*) str, len); |
276 |
+ if (suffix) newStr[prefix+len] = DIRECTORY_SEPARATOR; |
277 |
+ |
278 |
++/* |
279 |
+ if (prefix+len+suffix > MAX_PATH_LEN) { |
280 |
+ newStr[MAX_PATH_LEN] = '\0'; |
281 |
+ } else { |
282 |
+ newStr[prefix+len+suffix] = '\0'; |
283 |
+ } |
284 |
++*/ |
285 |
+ |
286 |
+ ret = addStringToStringList(stringList, newStr); |
287 |
+ |
288 |
+@@ -137,7 +138,7 @@ |
289 |
+ parses command line options |
290 |
+ */ |
291 |
+ |
292 |
+- int8_t c; |
293 |
++ int8_t c,len; |
294 |
+ |
295 |
+ static struct option longOpts[] = { |
296 |
+ // name, has_arg, flag, val |
297 |
+@@ -315,12 +316,13 @@ |
298 |
+ case 't' : OPT_MODIFICATION = 1; break; |
299 |
+ case 'v' : OPT_VERSION = 1; break; |
300 |
+ case 'L' : |
301 |
+- OPT_LOCALE=realloc(OPT_LOCALE, strlen(optarg)+1); |
302 |
++ len=strlen(optarg); |
303 |
++ OPT_LOCALE=realloc(OPT_LOCALE, len+1); |
304 |
+ if (OPT_LOCALE == NULL) { |
305 |
+ stderror(); |
306 |
+ return -1; |
307 |
+ } |
308 |
+- strncpy(OPT_LOCALE, optarg, strlen(optarg)+1); |
309 |
++ memcpy(OPT_LOCALE, optarg, len+1); |
310 |
+ break; |
311 |
+ default : |
312 |
+ myerror("Unknown option '%c'.", optopt); |
313 |
+Index: src/stringlist.c |
314 |
+=================================================================== |
315 |
+--- a/src/stringlist.c (revision 606) |
316 |
++++ b/src/stringlist.c (revision 613) |
317 |
+@@ -78,8 +78,7 @@ |
318 |
+ return -1; |
319 |
+ } |
320 |
+ |
321 |
+- strncpy(stringList->next->str, str, len); |
322 |
+- stringList->next->str[len] = '\0'; |
323 |
++ memcpy(stringList->next->str, str, len+1); |
324 |
+ |
325 |
+ return 0; |
326 |
+ |
327 |
+Index: src/options.h |
328 |
+=================================================================== |
329 |
+--- a/src/options.h (revision 606) |
330 |
++++ b/src/options.h (revision 613) |
331 |
+@@ -35,7 +35,7 @@ |
332 |
+ extern struct sStringList *OPT_INCL_DIRS, *OPT_EXCL_DIRS, *OPT_INCL_DIRS_REC, *OPT_EXCL_DIRS_REC, *OPT_IGNORE_PREFIXES_LIST; |
333 |
+ extern struct sRegExList *OPT_REGEX_INCL, *OPT_REGEX_EXCL; |
334 |
+ |
335 |
+-char *OPT_LOCALE; |
336 |
++extern char *OPT_LOCALE; |
337 |
+ |
338 |
+ // parses command line options |
339 |
+ int32_t parse_options(int argc, char *argv[]); |