Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in src/patchsets/coreutils/8.23: 003_all_coreutils-gentoo-uname.patch 010_all_coreutils-tests.patch 030_all_coreutils-more-dir-colors.patch 040_all_coreutils-cp-mkdir-eexist.patch 051_all_coreutils-mangen.patch README.history
Date: Mon, 28 Jul 2014 09:43:19
Message-Id: 20140728094314.8F4502004E@flycatcher.gentoo.org
1 vapier 14/07/28 09:43:14
2
3 Added: 003_all_coreutils-gentoo-uname.patch
4 010_all_coreutils-tests.patch
5 030_all_coreutils-more-dir-colors.patch
6 040_all_coreutils-cp-mkdir-eexist.patch
7 051_all_coreutils-mangen.patch README.history
8 Log:
9 initial 8.23 patchset based on last 8.22 patchset
10
11 Revision Changes Path
12 1.1 src/patchsets/coreutils/8.23/003_all_coreutils-gentoo-uname.patch
13
14 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.23/003_all_coreutils-gentoo-uname.patch?rev=1.1&view=markup
15 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.23/003_all_coreutils-gentoo-uname.patch?rev=1.1&content-type=text/plain
16
17 Index: 003_all_coreutils-gentoo-uname.patch
18 ===================================================================
19 On linux platforms, grok /proc/cpuinfo for the CPU/vendor info.
20
21 Prob not suitable for upstream seeing as how it's 100% linux-specific
22 http://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00063.html
23
24 Patch originally by Carlos E. Gorges <carlos@×××××××××××××.br>, but
25 heavily reworked to suck less.
26
27 To add support for additional platforms, check out the show_cpuinfo()
28 func in the linux/arch/<ARCH>/ source tree of the kernel.
29
30 --- coreutils/src/uname.c
31 +++ coreutils/src/uname.c
32 @@ -50,6 +50,11 @@
33 # include <mach-o/arch.h>
34 #endif
35
36 +#if defined(__linux__)
37 +# define USE_PROCINFO
38 +# define UNAME_HARDWARE_PLATFORM
39 +#endif
40 +
41 #include "system.h"
42 #include "error.h"
43 #include "quote.h"
44 @@ -138,6 +143,117 @@
45 exit (status);
46 }
47
48 +#if defined(USE_PROCINFO)
49 +
50 +# if defined(__s390__) || defined(__s390x__)
51 +# define CPUINFO_FILE "/proc/sysinfo"
52 +# define CPUINFO_FORMAT "%64[^\t :]%*[ :]%256[^\n]%c"
53 +# else
54 +# define CPUINFO_FILE "/proc/cpuinfo"
55 +# define CPUINFO_FORMAT "%64[^\t:]\t:%256[^\n]%c"
56 +# endif
57 +
58 +# define PROCINFO_PROCESSOR 0
59 +# define PROCINFO_HARDWARE_PLATFORM 1
60 +
61 +static void __eat_cpuinfo_space(char *buf)
62 +{
63 + /* first eat trailing space */
64 + char *tmp = buf + strlen(buf) - 1;
65 + while (tmp > buf && isspace(*tmp))
66 + *tmp-- = '\0';
67 + /* then eat leading space */
68 + tmp = buf;
69 + while (*tmp && isspace(*tmp))
70 + tmp++;
71 + if (tmp != buf)
72 + memmove(buf, tmp, strlen(tmp)+1);
73 + /* finally collapse whitespace */
74 + tmp = buf;
75 + while (tmp[0] && tmp[1]) {
76 + if (isspace(tmp[0]) && isspace(tmp[1])) {
77 + memmove(tmp, tmp+1, strlen(tmp));
78 + continue;
79 + }
80 + ++tmp;
81 + }
82 +}
83 +
84 +static int __linux_procinfo(int x, char *fstr, size_t s)
85 +{
86 + FILE *fp;
87 +
88 + char *procinfo_keys[] = {
89 + /* --processor --hardware-platform */
90 + #if defined(__alpha__)
91 + "cpu model", "system type"
92 + #elif defined(__arm__)
93 + "Processor", "Hardware"
94 + #elif defined(__avr32__)
95 + "processor", "cpu family"
96 + #elif defined(__bfin__)
97 + "CPU", "BOARD Name"
98 + #elif defined(__cris__)
99 + "cpu", "cpu model"
100 + #elif defined(__frv__)
101 + "CPU-Core", "System"
102 + #elif defined(__i386__) || defined(__x86_64__)
103 + "model name", "vendor_id"
104 + #elif defined(__ia64__)
105 + "model name", "vendor"
106 + #elif defined(__hppa__)
107 + "cpu", "model"
108 + #elif defined(__m68k__)
109 + "CPU", "MMU"
110 + #elif defined(__mips__)
111 + "cpu model", "system type"
112 + #elif defined(__powerpc__) || defined(__powerpc64__)
113 + "cpu", "machine"
114 + #elif defined(__s390__) || defined(__s390x__)
115 + "Type", "Manufacturer"
116 + #elif defined(__sh__)
117 + "cpu type", "machine"
118 + #elif defined(sparc) || defined(__sparc__)
119 + "type", "cpu"
120 + #elif defined(__vax__)
121 + "cpu type", "cpu"
122 + #else
123 + "unknown", "unknown"
124 + #endif
125 + };
126 +
127 + if ((fp = fopen(CPUINFO_FILE, "r")) != NULL) {
128 + char key[65], value[257], eol, *ret = NULL;
129 +
130 + while (fscanf(fp, CPUINFO_FORMAT, key, value, &eol) != EOF) {
131 + __eat_cpuinfo_space(key);
132 + if (!strcmp(key, procinfo_keys[x])) {
133 + __eat_cpuinfo_space(value);
134 + ret = value;
135 + break;
136 + }
137 + if (eol != '\n') {
138 + /* we need two fscanf's here in case the previous
139 + * length limit caused us to read right up to the
140 + * newline ... doing "%*[^\n]\n" wont eat the newline
141 + */
142 + fscanf(fp, "%*[^\n]");
143 + fscanf(fp, "\n");
144 + }
145 + }
146 + fclose(fp);
147 +
148 + if (ret) {
149 + strncpy(fstr, ret, s);
150 + return 0;
151 + }
152 + }
153 +
154 + return -1;
155 +}
156 +
157 +#endif
158 +
159 /* Print ELEMENT, preceded by a space if something has already been
160 printed. */
161
162 @@ -250,10 +344,14 @@ main (int argc, char **argv)
163 if (toprint & PRINT_PROCESSOR)
164 {
165 char const *element = unknown;
166 -#if HAVE_SYSINFO && defined SI_ARCHITECTURE
167 +#if ( HAVE_SYSINFO && defined SI_ARCHITECTURE ) || defined(USE_PROCINFO)
168 {
169 static char processor[257];
170 +#if defined(USE_PROCINFO)
171 + if (0 <= __linux_procinfo (PROCINFO_PROCESSOR, processor, sizeof processor))
172 +#else
173 if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
174 +#endif
175 element = processor;
176 }
177 #endif
178 @@ -306,9 +404,13 @@ main (int argc, char **argv)
179 if (element == unknown)
180 {
181 static char hardware_platform[257];
182 +#if defined(USE_PROCINFO)
183 + if (0 <= __linux_procinfo (PROCINFO_HARDWARE_PLATFORM, hardware_platform, sizeof hardware_platform))
184 +#else
185 size_t s = sizeof hardware_platform;
186 static int mib[] = { CTL_HW, UNAME_HARDWARE_PLATFORM };
187 if (sysctl (mib, 2, hardware_platform, &s, 0, 0) >= 0)
188 +#endif
189 element = hardware_platform;
190 }
191 #endif
192
193
194
195 1.1 src/patchsets/coreutils/8.23/010_all_coreutils-tests.patch
196
197 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.23/010_all_coreutils-tests.patch?rev=1.1&view=markup
198 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.23/010_all_coreutils-tests.patch?rev=1.1&content-type=text/plain
199
200 Index: 010_all_coreutils-tests.patch
201 ===================================================================
202 this test only gets run as non-root, so giving it temp write access to the
203 root dir is safe since normal unix access will deny it #259876
204 --- a/tests/touch/not-owner.sh
205 +++ b/tests/touch/not-owner.sh
206 @@ -34,6 +34,7 @@
207 # Before fileutils-4.1, we'd get the following misleading
208 # diagnostic instead of '...: Permission denied'.
209 # touch: creating '/': Is a directory
210 +env SANDBOX_WRITE=${SANDBOX_WRITE}:/ \
211 touch / > out 2>&1 && fail=1
212
213 # On SunOS4, EPERM is 'Not owner'.
214
215 the dd test looks up a device and tries to test seeking on it. it shouldnt
216 cause any corruption because it uses a count of 0 and seeks past the end of
217 the device
218 --- a/tests/dd/skip-seek-past-dev.sh
219 +++ b/tests/dd/skip-seek-past-dev.sh
220 @@ -48,6 +48,7 @@
221 0+0 records out" > err_ok || framework_failure_
222 compare err_ok err || fail=1
223
224 +env SANDBOX_WRITE=${SANDBOX_WRITE}:$device \
225 timeout 10 dd bs=1 seek=$DEV_OFLOW count=0 status=noxfer > "$device" 2> err
226 test "$?" = "1" || fail=1
227 echo "dd: 'standard output': cannot seek: Invalid argument
228
229 running through strace and counting stat syscalls is off when using sandbox
230 https://bugs.gentoo.org/415487
231 --- a/tests/ls/stat-free-color.sh
232 +++ b/tests/ls/stat-free-color.sh
233 @@ -19,6 +19,8 @@
234 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
235 print_ver_ ls
236
237 +skip_ 'strace does not work under sandbox #415487'
238 +
239 # Note this list of _file name_ stat functions must be
240 # as cross platform as possible and so doesn't include
241 # fstatat64 as that's not available on aarch64 for example.
242
243
244
245 1.1 src/patchsets/coreutils/8.23/030_all_coreutils-more-dir-colors.patch
246
247 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.23/030_all_coreutils-more-dir-colors.patch?rev=1.1&view=markup
248 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.23/030_all_coreutils-more-dir-colors.patch?rev=1.1&content-type=text/plain
249
250 Index: 030_all_coreutils-more-dir-colors.patch
251 ===================================================================
252 --- coreutils-7.5/src/dircolors.hin
253 +++ coreutils-7.5/src/dircolors.hin
254 @@ -5,6 +5,9 @@
255
256 # The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
257 # slackware version of dircolors) are recognized but ignored.
258 +
259 +# You can copy this file to .dir_colors in your $HOME directory to override
260 +# the system defaults.
261
262 # Below, there should be one TERM entry for each termtype that is colorizable
263 TERM Eterm
264 @@ -66,7 +66,8 @@
265 DOOR 01;35 # door
266 BLK 40;33;01 # block device driver
267 CHR 40;33;01 # character device driver
268 -ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file
269 +ORPHAN 01;05;37;41 # orphaned syminks
270 +MISSING 01;05;37;41 # ... and the files they point to
271 SETUID 37;41 # file that is setuid (u+s)
272 SETGID 30;43 # file that is setgid (g+s)
273 STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
274 @@ -125,6 +154,16 @@
275 .xwd 01;35
276 .yuv 01;35
277
278 +# Document files
279 +.pdf 00;32
280 +.ps 00;32
281 +.txt 00;32
282 +.patch 00;32
283 +.diff 00;32
284 +.log 00;32
285 +.tex 00;32
286 +.doc 00;32
287 +
288 # audio formats
289 .aac 00;36
290 .au 00;36
291
292
293
294 1.1 src/patchsets/coreutils/8.23/040_all_coreutils-cp-mkdir-eexist.patch
295
296 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.23/040_all_coreutils-cp-mkdir-eexist.patch?rev=1.1&view=markup
297 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.23/040_all_coreutils-cp-mkdir-eexist.patch?rev=1.1&content-type=text/plain
298
299 Index: 040_all_coreutils-cp-mkdir-eexist.patch
300 ===================================================================
301 https://bugs.gentoo.org/449838
302 http://lists.gnu.org/archive/html/bug-coreutils/2013-01/msg00002.html
303
304 From 597db089bfa64656540206b3826e0a97759f6720 Mon Sep 17 00:00:00 2001
305 From: Mike Frysinger <vapier@g.o>
306 Date: Thu, 3 Jan 2013 18:31:37 -0500
307 Subject: [PATCH] cp: ignore EEXIST errors from mkdir
308
309 If you're copying multiple source trees into a single destination in
310 parallel (which have overlapping dirs, but not files), you can easily
311 hit a race condition.
312
313 This can crop up more generally if you're running multiple installs
314 from different build directories in parallel. You don't get as much
315 of a speed up due to the parallel I/O, but you do from processing all
316 the build scripts.
317
318 Simple test to reproduce:
319 mkdir -p in/`printf %s/ {a..z} {0..10}`
320 (rm -rf out; for ((i=0;i<100;++i)); do cp -pPR in out & :; done)
321
322 * src/cp.c (make_dir_parents_private): Ignore EEXIST from mkdir.
323 ---
324 src/cp.c | 12 +++++++++---
325 1 file changed, 9 insertions(+), 3 deletions(-)
326
327 diff --git a/src/cp.c b/src/cp.c
328 index 625ea0b..b9dff18 100644
329 --- a/src/cp.c
330 +++ b/src/cp.c
331 @@ -473,9 +473,15 @@ make_dir_parents_private (char const *const_dir, size_t src_offset,
332 mkdir_mode = src_mode & CHMOD_MODE_BITS & ~omitted_permissions;
333 if (mkdir (dir, mkdir_mode) != 0)
334 {
335 - error (0, errno, _("cannot make directory %s"),
336 - quote (dir));
337 - return false;
338 + /* If someone else created it between our stat/mkdir,
339 + don't complain. It's debatable whether we should
340 + also preserve the mode bits in this scenario. */
341 + if (errno != EEXIST)
342 + {
343 + error (0, errno, _("cannot make directory %s"),
344 + quote (dir));
345 + return false;
346 + }
347 }
348 else
349 {
350 --
351 1.8.0.2
352
353
354
355
356 1.1 src/patchsets/coreutils/8.23/051_all_coreutils-mangen.patch
357
358 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.23/051_all_coreutils-mangen.patch?rev=1.1&view=markup
359 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.23/051_all_coreutils-mangen.patch?rev=1.1&content-type=text/plain
360
361 Index: 051_all_coreutils-mangen.patch
362 ===================================================================
363 avoid regenerating man pages all the time (since the locally compiled binaries
364 will always be newer than the bundled man pages)
365
366 --- a/Makefile.in
367 +++ b/Makefile.in
368 @@ -14038,7 +14038,6 @@ check-local: check-texinfo
369 distclean-local:
370 test x$(srcdir) = x$(builddir) || rm -f $(ALL_MANS)
371
372 -$(ALL_MANS): $(mandeps)
373 man/dynamic-deps.mk: Makefile
374 $(AM_V_GEN)rm -f $@ $@-t
375 $(AM_V_at)for man in $(ALL_MANS); do \
376 @@ -14058,9 +14057,6 @@ man/dynamic-deps.mk: Makefile
377 done > $@-t \
378 && mv $@-t $@
379
380 -# Include the generated man dependencies.
381 -@AMDEP_TRUE@@am__include@ man/dynamic-deps.mk
382 -
383 .x.1:
384 $(AM_V_GEN)name=`echo $@ | sed 's|.*/||; s|\.1$$||'` || exit 1; \
385 case $$name in \
386
387
388
389 1.1 src/patchsets/coreutils/8.23/README.history
390
391 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.23/README.history?rev=1.1&view=markup
392 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.23/README.history?rev=1.1&content-type=text/plain
393
394 Index: README.history
395 ===================================================================
396 1.0 28 Jul 2014
397 + 003_all_coreutils-gentoo-uname.patch
398 + 010_all_coreutils-tests.patch
399 + 030_all_coreutils-more-dir-colors.patch
400 + 040_all_coreutils-cp-mkdir-eexist.patch
401 + 051_all_coreutils-mangen.patch