1 |
vapier 09/03/31 20:17:38 |
2 |
|
3 |
Added: 001_all_coreutils-gen-progress-bar.patch |
4 |
003_all_coreutils-gentoo-uname.patch |
5 |
010_all_coreutils-tests.patch |
6 |
030_all_coreutils-more-dir-colors.patch |
7 |
README.history |
8 |
Log: |
9 |
initial 7.2 patchset import pased on last 7.1 patchset |
10 |
|
11 |
Revision Changes Path |
12 |
1.1 src/patchsets/coreutils/7.2/001_all_coreutils-gen-progress-bar.patch |
13 |
|
14 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/7.2/001_all_coreutils-gen-progress-bar.patch?rev=1.1&view=markup |
15 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/7.2/001_all_coreutils-gen-progress-bar.patch?rev=1.1&content-type=text/plain |
16 |
|
17 |
Index: 001_all_coreutils-gen-progress-bar.patch |
18 |
=================================================================== |
19 |
Upstream has been contacted about this a few times ... |
20 |
|
21 |
they dont want progress bars in mv/cp: |
22 |
http://lists.gnu.org/archive/html/bug-coreutils/2003-08/msg00114.html |
23 |
http://lists.gnu.org/archive/html/bug-coreutils/2003-09/msg00083.html |
24 |
http://lists.gnu.org/archive/html/bug-coreutils/2003-09/msg00084.html |
25 |
|
26 |
but they don't seem to mind a general util ... add this to future patchset: |
27 |
http://lists.gnu.org/archive/html/bug-coreutils/2003-09/msg00101.html |
28 |
http://lists.gnu.org/archive/html/bug-coreutils/2004-02/msg00071.html |
29 |
|
30 |
--- coreutils/src/copy.c |
31 |
+++ coreutils/src/copy.c |
32 |
@@ -17,6 +17,8 @@ |
33 |
|
34 |
/* Extracted from cp.c and librarified by Jim Meyering. */ |
35 |
|
36 |
+/* Progress bar support added by Miika Pekkarinen. miipekk@××××.org */ |
37 |
+ |
38 |
#include <config.h> |
39 |
#include <stdio.h> |
40 |
#include <assert.h> |
41 |
@@ -29,6 +31,10 @@ |
42 |
# include <priv.h> |
43 |
#endif |
44 |
|
45 |
+#ifdef GWINSZ_IN_SYS_IOCTL |
46 |
+# include <sys/ioctl.h> |
47 |
+#endif |
48 |
+ |
49 |
#include "system.h" |
50 |
#include "acl.h" |
51 |
#include "backupfile.h" |
52 |
@@ -50,6 +56,9 @@ |
53 |
#include "utimens.h" |
54 |
#include "xreadlink.h" |
55 |
#include "yesno.h" |
56 |
+#include "xstrtol.h" |
57 |
+#include "human.h" |
58 |
+#include "quotearg.h" |
59 |
|
60 |
#ifndef HAVE_FCHOWN |
61 |
# define HAVE_FCHOWN false |
62 |
@@ -85,6 +92,8 @@ struct F_triple |
63 |
/* Initial size of the above hash table. */ |
64 |
#define DEST_INFO_INITIAL_CAPACITY 61 |
65 |
|
66 |
+#define SAMPLE_MAX 10 |
67 |
+ |
68 |
static bool copy_internal (char const *src_name, char const *dst_name, |
69 |
bool new_dst, dev_t device, |
70 |
struct dir_list *ancestors, |
71 |
@@ -191,6 +200,31 @@ copy_dir (char const *src_name_in, char |
72 |
#endif |
73 |
} |
74 |
|
75 |
+/* Shorten a string '/long path/long file' to 'long fi...' |
76 |
+ Also adds padding bytes to end of the string if necessary */ |
77 |
+char *shorten_name(const char *str, size_t max_width) |
78 |
+{ |
79 |
+ char *shortname; |
80 |
+ const char *filename; |
81 |
+ size_t len; |
82 |
+ |
83 |
+ filename = base_name (str); |
84 |
+ len = strlen(filename); |
85 |
+ shortname = (char *) xmalloc (max_width + 1); |
86 |
+ strncpy (shortname, filename, max_width); |
87 |
+ shortname[max_width] = '\0'; |
88 |
+ if (len > max_width) |
89 |
+ { |
90 |
+ memset(shortname + max_width - 3, '.', 3); |
91 |
+ } |
92 |
+ else |
93 |
+ { |
94 |
+ memset(shortname + len, ' ', max_width - len); |
95 |
+ } |
96 |
+ |
97 |
+ return shortname; |
98 |
+} |
99 |
+ |
100 |
/* Copy a regular file from SRC_NAME to DST_NAME. |
101 |
If the source file contains holes, copies holes and blocks of zeros |
102 |
in the source file as holes in the destination file. |
103 |
@@ -222,6 +287,19 @@ copy_reg (char const *src_name, char con |
104 |
struct stat sb; |
105 |
struct stat src_open_sb; |
106 |
bool return_val = true; |
107 |
+ time_t t_start; |
108 |
+ time_t t_last; |
109 |
+ time_t t_now; |
110 |
+ off_t last_bytes = 0; |
111 |
+ int progress_bar_printed = 0; |
112 |
+ char *shortname = NULL; |
113 |
+ off_t sample_window[SAMPLE_MAX]; |
114 |
+ off_t sample_sum = 0; |
115 |
+ int sample_count = 0; |
116 |
+ long int line_length = 0; |
117 |
+#ifdef TIOCGWINSZ |
118 |
+ struct winsize ws; |
119 |
+#endif |
120 |
|
121 |
source_desc = open (src_name, O_RDONLY | O_BINARY); |
122 |
if (source_desc < 0) |
123 |
@@ -326,6 +404,9 @@ copy_reg (char const *src_name, char con |
124 |
buf_alloc = xmalloc (buf_size + buf_alignment_slop); |
125 |
buf = ptr_align (buf_alloc, buf_alignment); |
126 |
|
127 |
+ time (&t_start); |
128 |
+ t_last = t_start; |
129 |
+ |
130 |
for (;;) |
131 |
{ |
132 |
word *wp = NULL; |
133 |
@@ -390,6 +471,110 @@ copy_reg (char const *src_name, char con |
134 |
if (n_read != buf_size && S_ISREG (src_open_sb.st_mode)) |
135 |
break; |
136 |
} |
137 |
+ |
138 |
+ time (&t_now); |
139 |
+ |
140 |
+ /* Progress bar stuff */ |
141 |
+ if (! x->pbar_show || t_now - t_start < x->pbar_delay) |
142 |
+ { |
143 |
+ continue; |
144 |
+ } |
145 |
+ |
146 |
+ if (! progress_bar_printed) |
147 |
+ { |
148 |
+ /* Column width check code copied from ls.c */ |
149 |
+ char const *p = getenv ("COLUMNS"); |
150 |
+ if (p && *p) |
151 |
+ { |
152 |
+ long int tmp_long; |
153 |
+ if (xstrtol (p, NULL, 0, &tmp_long, NULL) == LONGINT_OK |
154 |
+ && 0 < tmp_long && tmp_long <= INT_MAX) |
155 |
+ { |
156 |
+ line_length = tmp_long; |
157 |
+ } |
158 |
+ else |
159 |
+ { |
160 |
+ error (0, 0, |
161 |
+ _("ignoring invalid width in environment \ |
162 |
+ variable COLUMNS: %s"), |
163 |
+ quotearg (p)); |
164 |
+ } |
165 |
+ } |
166 |
+ |
167 |
+#ifdef TIOCGWINSZ |
168 |
+ if (ioctl (STDOUT_FILENO, TIOCGWINSZ, &ws) != -1 && ws.ws_col != 0) |
169 |
+ { |
170 |
+ line_length = ws.ws_col; |
171 |
+ } |
172 |
+#endif |
173 |
+ if (line_length < 50) |
174 |
+ { |
175 |
+ continue; |
176 |
+ } |
177 |
+ |
178 |
+ /* Take a short filename for progress bar */ |
179 |
+ shortname = shorten_name(src_name, line_length - 48); |
180 |
+ progress_bar_printed = 1; |
181 |
+ } |
182 |
+ |
183 |
+ if (t_now == t_last) |
184 |
+ { |
185 |
+ continue; |
186 |
+ } |
187 |
+ |
188 |
+ if (sample_count == SAMPLE_MAX) |
189 |
+ { |
190 |
+ int i; |
191 |
+ |
192 |
+ sample_sum -= sample_window[0]; |
193 |
+ for (i = 0; i < SAMPLE_MAX - 1; i++) |
194 |
+ { |
195 |
+ sample_window[i] = sample_window[i + 1]; |
196 |
+ } |
197 |
+ } |
198 |
+ else |
199 |
+ { |
200 |
+ sample_count++; |
201 |
+ } |
202 |
+ |
203 |
+ { |
204 |
+ char str_size[LONGEST_HUMAN_READABLE + 1]; |
205 |
+ char str_speed[LONGEST_HUMAN_READABLE + 1]; |
206 |
+ char etabuf[64]; |
207 |
+ time_t t_temp; |
208 |
+ |
209 |
+ sample_window[sample_count - 1] = (n_read_total - last_bytes) / |
210 |
+ (t_now - t_last); |
211 |
+ sample_sum += sample_window[sample_count - 1]; |
212 |
+ |
213 |
+ /* Calculate the remaining time */ |
214 |
+ t_temp = (src_open_sb.st_size - n_read_total) / (sample_sum / sample_count); |
215 |
+ |
216 |
+ /* Don't print the progress bar if the estimated remaining |
217 |
+ time is low. */ |
218 |
+ if (progress_bar_printed == 1 && t_temp < x->pbar_min_est) |
219 |
+ { |
220 |
+ continue; |
221 |
+ } |
222 |
+ progress_bar_printed = 2; |
223 |
+ |
224 |
+ strftime(etabuf, sizeof etabuf, "%H:%M.%S", |
225 |
+ gmtime(&t_temp)); |
226 |
+ printf (_("%s | %3lu%% | %9s | %9s/s | ETA %s\r"), shortname, |
227 |
+ (unsigned long)(n_read_total * 100 / src_open_sb.st_size), |
228 |
+ human_readable(src_open_sb.st_size, str_size, human_autoscale|human_base_1024|human_space_before_unit|human_SI|human_B, 1, 1), |
229 |
+ human_readable(sample_sum / sample_count, str_speed, human_autoscale|human_base_1024|human_space_before_unit|human_SI|human_B, 1, 1), |
230 |
+ etabuf); |
231 |
+ fflush (stdout); |
232 |
+ t_last = t_now; |
233 |
+ last_bytes = n_read_total; |
234 |
+ } |
235 |
+ } |
236 |
+ |
237 |
+ /* Print a newline if progress bar is enabled and has been shown */ |
238 |
+ if (progress_bar_printed == 2) |
239 |
+ { |
240 |
+ printf ("%s | 100%%\n", shortname); |
241 |
} |
242 |
|
243 |
/* If the file ends with a `hole', we need to do something to record |
244 |
@@ -488,6 +676,11 @@ close_src_desc: |
245 |
return_val = false; |
246 |
} |
247 |
|
248 |
+ if (shortname != NULL) |
249 |
+ { |
250 |
+ free (shortname); |
251 |
+ } |
252 |
+ |
253 |
free (buf_alloc); |
254 |
return return_val; |
255 |
} |
256 |
--- coreutils/src/copy.h |
257 |
+++ coreutils/src/copy.h |
258 |
@@ -175,6 +175,16 @@ struct cp_options |
259 |
/* If true, display the names of the files before copying them. */ |
260 |
bool verbose; |
261 |
|
262 |
+ /* If true, display a progress bar when the following conditions are |
263 |
+ * met: |
264 |
+ - pbar_delay defines how many seconds to wait before considering to |
265 |
+ display the progress bar |
266 |
+ - pbar_min_est defines how many seconds estimated operation complete |
267 |
+ time should be at least to show the progress bar. */ |
268 |
+ bool pbar_show; |
269 |
+ int pbar_delay; |
270 |
+ int pbar_min_est; |
271 |
+ |
272 |
/* If true, stdin is a tty. */ |
273 |
bool stdin_tty; |
274 |
|
275 |
--- coreutils/src/cp.c |
276 |
+++ coreutils/src/cp.c |
277 |
@@ -81,6 +81,14 @@ enum |
278 |
/* Initial number of entries in the inode hash table. */ |
279 |
#define INITIAL_ENTRY_TAB_SIZE 70 |
280 |
|
281 |
+/* Initial settings for progress bar when it's enabled. |
282 |
+ PROGRESS_DELAY defines how many seconds to wait before even |
283 |
+ considering to display a proggress bar. |
284 |
+ PROGRESS_MIN_EST defines how many seconds estimated operation |
285 |
+ complete time should be at least to show the progress bar. */ |
286 |
+#define PROGRESS_DELAY 5 |
287 |
+#define PROGRESS_MIN_EST 5 |
288 |
+ |
289 |
/* The invocation name of this program. */ |
290 |
char *program_name; |
291 |
|
292 |
@@ -120,6 +128,7 @@ static struct option const long_opts[] = |
293 |
{"copy-contents", no_argument, NULL, COPY_CONTENTS_OPTION}, |
294 |
{"dereference", no_argument, NULL, 'L'}, |
295 |
{"force", no_argument, NULL, 'f'}, |
296 |
+ {"progress", no_argument, NULL, 'g'}, |
297 |
{"interactive", no_argument, NULL, 'i'}, |
298 |
{"link", no_argument, NULL, 'l'}, |
299 |
{"no-dereference", no_argument, NULL, 'P'}, |
300 |
@@ -176,6 +185,8 @@ Mandatory arguments to long options are |
301 |
fputs (_("\ |
302 |
-f, --force if an existing destination file cannot be\n\ |
303 |
opened, remove it and try again\n\ |
304 |
+ -g, --progress show a progress bar if operation is going to\n\ |
305 |
+ take a long time\n\ |
306 |
-i, --interactive prompt before overwrite\n\ |
307 |
-H follow command-line symbolic links\n\ |
308 |
"), stdout); |
309 |
@@ -705,6 +716,11 @@ cp_option_init (struct cp_options *x) |
310 |
|
311 |
x->update = false; |
312 |
x->verbose = false; |
313 |
+ |
314 |
+ x->pbar_show = false; |
315 |
+ x->pbar_delay = PROGRESS_DELAY; |
316 |
+ x->pbar_min_est = PROGRESS_MIN_EST; |
317 |
+ |
318 |
x->dest_info = NULL; |
319 |
x->src_info = NULL; |
320 |
} |
321 |
@@ -811,7 +827,7 @@ main (int argc, char **argv) |
322 |
we'll actually use backup_suffix_string. */ |
323 |
backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX"); |
324 |
|
325 |
- while ((c = getopt_long (argc, argv, "abdfHilLprst:uvxPRS:T", |
326 |
+ while ((c = getopt_long (argc, argv, "abdfgHilLprst:uvxPRS:T", |
327 |
long_opts, NULL)) |
328 |
!= -1) |
329 |
{ |
330 |
@@ -871,6 +887,10 @@ main (int argc, char **argv) |
331 |
x.dereference = DEREF_NEVER; |
332 |
break; |
333 |
|
334 |
+ case 'g': |
335 |
+ x.pbar_show = true; |
336 |
+ break; |
337 |
+ |
338 |
case NO_PRESERVE_ATTRIBUTES_OPTION: |
339 |
decode_preserve_arg (optarg, &x, false); |
340 |
break; |
341 |
--- coreutils/src/mv.c |
342 |
+++ coreutils/src/mv.c |
343 |
@@ -45,6 +45,14 @@ |
344 |
/* Initial number of entries in the inode hash table. */ |
345 |
#define INITIAL_ENTRY_TAB_SIZE 70 |
346 |
|
347 |
+/* Initial settings for progress bar when it's enabled. |
348 |
+ PROGRESS_DELAY defines how many seconds to wait before even |
349 |
+ considering to display a proggress bar. |
350 |
+ PROGRESS_MIN_EST defines how many seconds estimated operation |
351 |
+ complete time should be at least to show the progress bar. */ |
352 |
+#define PROGRESS_DELAY 5 |
353 |
+#define PROGRESS_MIN_EST 5 |
354 |
+ |
355 |
/* For long options that have no equivalent short option, use a |
356 |
non-character as a pseudo short option, starting with CHAR_MAX + 1. */ |
357 |
enum |
358 |
@@ -75,6 +83,7 @@ static struct option const long_options[ |
359 |
{ |
360 |
{"backup", optional_argument, NULL, 'b'}, |
361 |
{"force", no_argument, NULL, 'f'}, |
362 |
+ {"progress", no_argument, NULL, 'g'}, |
363 |
{"interactive", no_argument, NULL, 'i'}, |
364 |
{"no-target-directory", no_argument, NULL, 'T'}, |
365 |
{"reply", required_argument, NULL, REPLY_OPTION}, /* Deprecated 2005-07-03, |
366 |
@@ -104,6 +113,10 @@ rm_option_init (struct rm_options *x) |
367 |
|
368 |
x->verbose = false; |
369 |
|
370 |
+ x->pbar_show = false; |
371 |
+ x->pbar_delay = PROGRESS_DELAY; |
372 |
+ x->pbar_min_est = PROGRESS_MIN_EST; |
373 |
+ |
374 |
/* Since this program may well have to process additional command |
375 |
line arguments after any call to `rm', that function must preserve |
376 |
the initial working directory, in case one of those is a |
377 |
@@ -145,6 +158,10 @@ |
378 |
x->set_mode = false; |
379 |
x->mode = 0; |
380 |
x->stdin_tty = isatty (STDIN_FILENO); |
381 |
+ |
382 |
+ x->pbar_show = false; |
383 |
+ x->pbar_delay = PROGRESS_DELAY; |
384 |
+ x->pbar_min_est = PROGRESS_MIN_EST; |
385 |
|
386 |
x->verbose = false; |
387 |
x->dest_info = NULL; |
388 |
@@ -312,6 +325,8 @@ Mandatory arguments to long options are |
389 |
--backup[=CONTROL] make a backup of each existing destination file\n\ |
390 |
-b like --backup but does not accept an argument\n\ |
391 |
-f, --force do not prompt before overwriting\n\ |
392 |
+ -g, --progress show a progress bar if operation is going to\n\ |
393 |
+ take a long time\n\ |
394 |
-i, --interactive prompt before overwrite\n\ |
395 |
"), stdout); |
396 |
fputs (_("\ |
397 |
@@ -375,7 +393,7 @@ main (int argc, char **argv) |
398 |
we'll actually use backup_suffix_string. */ |
399 |
backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX"); |
400 |
|
401 |
- while ((c = getopt_long (argc, argv, "bfit:uvS:T", long_options, NULL)) |
402 |
+ while ((c = getopt_long (argc, argv, "bfgit:uvS:T", long_options, NULL)) |
403 |
!= -1) |
404 |
{ |
405 |
switch (c) |
406 |
@@ -388,6 +406,9 @@ main (int argc, char **argv) |
407 |
case 'f': |
408 |
x.interactive = I_ALWAYS_YES; |
409 |
break; |
410 |
+ case 'g': |
411 |
+ x.pbar_show = true; |
412 |
+ break; |
413 |
case 'i': |
414 |
x.interactive = I_ASK_USER; |
415 |
break; |
416 |
--- coreutils/src/remove.h |
417 |
+++ coreutils/src/remove.h |
418 |
@@ -48,6 +48,16 @@ struct rm_options |
419 |
/* If true, display the name of each file removed. */ |
420 |
bool verbose; |
421 |
|
422 |
+ /* If true, display a progress bar when the following conditions are |
423 |
+ * met: |
424 |
+ - pbar_delay defines how many seconds to wait before considering to |
425 |
+ display the progress bar |
426 |
+ - pbar_min_est defines how many seconds estimated operation complete |
427 |
+ time should be at least to show the progress bar. */ |
428 |
+ bool pbar_show; |
429 |
+ int pbar_delay; |
430 |
+ int pbar_min_est; |
431 |
+ |
432 |
/* If true, treat the failure by the rm function to restore the |
433 |
current working directory as a fatal error. I.e., if this field |
434 |
is true and the rm function cannot restore cwd, it must exit with |
435 |
|
436 |
|
437 |
|
438 |
1.1 src/patchsets/coreutils/7.2/003_all_coreutils-gentoo-uname.patch |
439 |
|
440 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/7.2/003_all_coreutils-gentoo-uname.patch?rev=1.1&view=markup |
441 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/7.2/003_all_coreutils-gentoo-uname.patch?rev=1.1&content-type=text/plain |
442 |
|
443 |
Index: 003_all_coreutils-gentoo-uname.patch |
444 |
=================================================================== |
445 |
On linux platforms, grok /proc/cpuinfo for the CPU/vendor info. |
446 |
|
447 |
Prob not suitable for upstream seeing as how it's 100% linux-specific |
448 |
http://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00063.html |
449 |
|
450 |
Patch originally by Carlos E. Gorges <carlos@×××××××××××××.br>, but |
451 |
heavily reworked to suck less. |
452 |
|
453 |
To add support for additional platforms, check out the show_cpuinfo() |
454 |
func in the linux/arch/<ARCH>/ source tree of the kernel. |
455 |
|
456 |
--- coreutils/src/uname.c |
457 |
+++ coreutils/src/uname.c |
458 |
@@ -51,6 +51,11 @@ |
459 |
# include <mach-o/arch.h> |
460 |
#endif |
461 |
|
462 |
+#if defined(__linux__) |
463 |
+# define USE_PROCINFO |
464 |
+# define UNAME_HARDWARE_PLATFORM |
465 |
+#endif |
466 |
+ |
467 |
#include "system.h" |
468 |
#include "error.h" |
469 |
#include "quote.h" |
470 |
@@ -138,6 +143,117 @@ |
471 |
exit (status); |
472 |
} |
473 |
|
474 |
+#if defined(USE_PROCINFO) |
475 |
+ |
476 |
+# if defined(__s390__) || defined(__s390x__) |
477 |
+# define CPUINFO_FILE "/proc/sysinfo" |
478 |
+# define CPUINFO_FORMAT "%64[^\t :]%*[ :]%256[^\n]%c" |
479 |
+# else |
480 |
+# define CPUINFO_FILE "/proc/cpuinfo" |
481 |
+# define CPUINFO_FORMAT "%64[^\t:]\t:%256[^\n]%c" |
482 |
+# endif |
483 |
+ |
484 |
+# define PROCINFO_PROCESSOR 0 |
485 |
+# define PROCINFO_HARDWARE_PLATFORM 1 |
486 |
+ |
487 |
+static void __eat_cpuinfo_space(char *buf) |
488 |
+{ |
489 |
+ /* first eat trailing space */ |
490 |
+ char *tmp = buf + strlen(buf) - 1; |
491 |
+ while (tmp > buf && isspace(*tmp)) |
492 |
+ *tmp-- = '\0'; |
493 |
+ /* then eat leading space */ |
494 |
+ tmp = buf; |
495 |
+ while (*tmp && isspace(*tmp)) |
496 |
+ tmp++; |
497 |
+ if (tmp != buf) |
498 |
+ memmove(buf, tmp, strlen(tmp)+1); |
499 |
+ /* finally collapse whitespace */ |
500 |
+ tmp = buf; |
501 |
+ while (tmp[0] && tmp[1]) { |
502 |
+ if (isspace(tmp[0]) && isspace(tmp[1])) { |
503 |
+ memmove(tmp, tmp+1, strlen(tmp)); |
504 |
+ continue; |
505 |
+ } |
506 |
+ ++tmp; |
507 |
+ } |
508 |
+} |
509 |
+ |
510 |
+static int __linux_procinfo(int x, char *fstr, size_t s) |
511 |
+{ |
512 |
+ FILE *fp; |
513 |
+ |
514 |
+ char *procinfo_keys[] = { |
515 |
+ /* --processor --hardware-platform */ |
516 |
+ #if defined(__alpha__) |
517 |
+ "cpu model", "system type" |
518 |
+ #elif defined(__arm__) |
519 |
+ "Processor", "Hardware" |
520 |
+ #elif defined(__avr32__) |
521 |
+ "processor", "cpu family" |
522 |
+ #elif defined(__bfin__) |
523 |
+ "CPU", "BOARD Name" |
524 |
+ #elif defined(__cris__) |
525 |
+ "cpu", "cpu model" |
526 |
+ #elif defined(__frv__) |
527 |
+ "CPU-Core", "System" |
528 |
+ #elif defined(__i386__) || defined(__x86_64__) |
529 |
+ "model name", "vendor_id" |
530 |
+ #elif defined(__ia64__) |
531 |
+ "family", "vendor" |
532 |
+ #elif defined(__hppa__) |
533 |
+ "cpu", "model" |
534 |
+ #elif defined(__m68k__) |
535 |
+ "CPU", "MMU" |
536 |
+ #elif defined(__mips__) |
537 |
+ "cpu model", "system type" |
538 |
+ #elif defined(__powerpc__) || defined(__powerpc64__) |
539 |
+ "cpu", "machine" |
540 |
+ #elif defined(__s390__) || defined(__s390x__) |
541 |
+ "Type", "Manufacturer" |
542 |
+ #elif defined(__sh__) |
543 |
+ "cpu type", "machine" |
544 |
+ #elif defined(sparc) || defined(__sparc__) |
545 |
+ "type", "cpu" |
546 |
+ #elif defined(__vax__) |
547 |
+ "cpu type", "cpu" |
548 |
+ #else |
549 |
+ "unknown", "unknown" |
550 |
+ #endif |
551 |
+ }; |
552 |
+ |
553 |
+ if ((fp = fopen(CPUINFO_FILE, "r")) != NULL) { |
554 |
+ char key[65], value[257], eol, *ret = NULL; |
555 |
+ |
556 |
+ while (fscanf(fp, CPUINFO_FORMAT, key, value, &eol) != EOF) { |
557 |
+ __eat_cpuinfo_space(key); |
558 |
+ if (!strcmp(key, procinfo_keys[x])) { |
559 |
+ __eat_cpuinfo_space(value); |
560 |
+ ret = value; |
561 |
+ break; |
562 |
+ } |
563 |
+ if (eol != '\n') { |
564 |
+ /* we need two fscanf's here in case the previous |
565 |
+ * length limit caused us to read right up to the |
566 |
+ * newline ... doing "%*[^\n]\n" wont eat the newline |
567 |
+ */ |
568 |
+ fscanf(fp, "%*[^\n]"); |
569 |
+ fscanf(fp, "\n"); |
570 |
+ } |
571 |
+ } |
572 |
+ fclose(fp); |
573 |
+ |
574 |
+ if (ret) { |
575 |
+ strncpy(fstr, ret, s); |
576 |
+ return 0; |
577 |
+ } |
578 |
+ } |
579 |
+ |
580 |
+ return -1; |
581 |
+} |
582 |
+ |
583 |
+#endif |
584 |
+ |
585 |
/* Print ELEMENT, preceded by a space if something has already been |
586 |
printed. */ |
587 |
|
588 |
@@ -250,10 +344,14 @@ main (int argc, char **argv) |
589 |
if (toprint & PRINT_PROCESSOR) |
590 |
{ |
591 |
char const *element = unknown; |
592 |
-#if HAVE_SYSINFO && defined SI_ARCHITECTURE |
593 |
+#if ( HAVE_SYSINFO && defined SI_ARCHITECTURE ) || defined(USE_PROCINFO) |
594 |
{ |
595 |
static char processor[257]; |
596 |
+#if defined(USE_PROCINFO) |
597 |
+ if (0 <= __linux_procinfo (PROCINFO_PROCESSOR, processor, sizeof processor)) |
598 |
+#else |
599 |
if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor)) |
600 |
+#endif |
601 |
element = processor; |
602 |
} |
603 |
#endif |
604 |
@@ -306,9 +404,13 @@ main (int argc, char **argv) |
605 |
if (element == unknown) |
606 |
{ |
607 |
static char hardware_platform[257]; |
608 |
+#if defined(USE_PROCINFO) |
609 |
+ if (0 <= __linux_procinfo (PROCINFO_HARDWARE_PLATFORM, hardware_platform, sizeof hardware_platform)) |
610 |
+#else |
611 |
size_t s = sizeof hardware_platform; |
612 |
static int mib[] = { CTL_HW, UNAME_HARDWARE_PLATFORM }; |
613 |
if (sysctl (mib, 2, hardware_platform, &s, 0, 0) >= 0) |
614 |
+#endif |
615 |
element = hardware_platform; |
616 |
} |
617 |
#endif |
618 |
|
619 |
|
620 |
|
621 |
1.1 src/patchsets/coreutils/7.2/010_all_coreutils-tests.patch |
622 |
|
623 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/7.2/010_all_coreutils-tests.patch?rev=1.1&view=markup |
624 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/7.2/010_all_coreutils-tests.patch?rev=1.1&content-type=text/plain |
625 |
|
626 |
Index: 010_all_coreutils-tests.patch |
627 |
=================================================================== |
628 |
this test only gets run as non-root, so giving it temp write access to the |
629 |
root dir is safe since normal unix access will deny it #259876 |
630 |
--- a/tests/touch/not-owner |
631 |
+++ b/tests/touch/not-owner |
632 |
@@ -39,7 +39,10 @@ |
633 |
# Before fileutils-4.1, we'd get the following misleading |
634 |
# diagnostic instead of `...: Permission denied'. |
635 |
# touch: creating `/': Is a directory |
636 |
+save_sbw=${SANDBOX_WRITE} |
637 |
+export SANDBOX_WRITE=${SANDBOX_WRITE}:/ |
638 |
touch / > out 2>&1 && fail=1 |
639 |
+SANDBOX_WRITE=${save_sbw} |
640 |
|
641 |
# On SunOS4, EPERM is `Not owner'. |
642 |
# On some *BSD systems it's `Operation not permitted'. |
643 |
|
644 |
the dd test looks up a device and tries to test seeking on it. it shouldnt |
645 |
cause any corruption because it uses a count of 0 and seeks past the end of |
646 |
the device |
647 |
--- a/tests/dd/skip-seek-past-dev |
648 |
+++ b/tests/dd/skip-seek-past-dev |
649 |
@@ -53,8 +53,11 @@ |
650 |
0+0 records out" > err_ok || framework_failure |
651 |
compare err_ok err || fail=1 |
652 |
|
653 |
+save_sbw=${SANDBOX_WRITE} |
654 |
+export SANDBOX_WRITE=${SANDBOX_WRITE}:$device |
655 |
timeout 1 dd bs=1 seek=$DEV_OFLOW count=0 status=noxfer > "$device" 2> err |
656 |
test "$?" = "1" || fail=1 |
657 |
+SANDBOX_WRITE=${save_sbw} |
658 |
echo "dd: \`standard output': cannot seek: Invalid argument |
659 |
0+0 records in |
660 |
0+0 records out" > err_ok || framework_failure |
661 |
|
662 |
we dont build/install the `groups` binary, so skip the test |
663 |
--- a/tests/misc/groups-dash |
664 |
+++ b/tests/misc/groups-dash |
665 |
@@ -23,6 +23,8 @@ |
666 |
|
667 |
. $srcdir/test-lib.sh |
668 |
|
669 |
+test -x "$abs_top_builddir/src/groups" || skip_test_ |
670 |
+ |
671 |
# Coreutils 6.9 and earlier failed to display information on first argument |
672 |
# if later argument was --. |
673 |
fail=0 |
674 |
|
675 |
|
676 |
|
677 |
1.1 src/patchsets/coreutils/7.2/030_all_coreutils-more-dir-colors.patch |
678 |
|
679 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/7.2/030_all_coreutils-more-dir-colors.patch?rev=1.1&view=markup |
680 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/7.2/030_all_coreutils-more-dir-colors.patch?rev=1.1&content-type=text/plain |
681 |
|
682 |
Index: 030_all_coreutils-more-dir-colors.patch |
683 |
=================================================================== |
684 |
--- coreutils-6.7/src/dircolors.hin |
685 |
+++ coreutils-6.7/src/dircolors.hin |
686 |
@@ -5,6 +5,9 @@ |
687 |
|
688 |
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the |
689 |
# slackware version of dircolors) are recognized but ignored. |
690 |
+ |
691 |
+# You can copy this file to .dir_colors in your $HOME directory to override |
692 |
+# the system defaults. |
693 |
|
694 |
# Below, there should be one TERM entry for each termtype that is colorizable |
695 |
TERM Eterm |
696 |
@@ -66,7 +66,8 @@ |
697 |
DOOR 01;35 # door |
698 |
BLK 40;33;01 # block device driver |
699 |
CHR 40;33;01 # character device driver |
700 |
-ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file |
701 |
+ORPHAN 01;05;37;41 # orphaned syminks |
702 |
+MISSING 01;05;37;41 # ... and the files they point to |
703 |
SETUID 37;41 # file that is setuid (u+s) |
704 |
SETGID 30;43 # file that is setgid (g+s) |
705 |
STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w) |
706 |
@@ -125,6 +154,16 @@ |
707 |
.xwd 01;35 |
708 |
.yuv 01;35 |
709 |
|
710 |
+# Document files |
711 |
+.pdf 00;32 |
712 |
+.ps 00;32 |
713 |
+.txt 00;32 |
714 |
+.patch 00;32 |
715 |
+.diff 00;32 |
716 |
+.log 00;32 |
717 |
+.tex 00;32 |
718 |
+.doc 00;32 |
719 |
+ |
720 |
# audio formats |
721 |
.aac 00;36 |
722 |
.au 00;36 |
723 |
|
724 |
|
725 |
|
726 |
1.1 src/patchsets/coreutils/7.2/README.history |
727 |
|
728 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/7.2/README.history?rev=1.1&view=markup |
729 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/7.2/README.history?rev=1.1&content-type=text/plain |
730 |
|
731 |
Index: README.history |
732 |
=================================================================== |
733 |
1 31.03.2009 |
734 |
+ 001_all_coreutils-gen-progress-bar.patch |
735 |
+ 003_all_coreutils-gentoo-uname.patch |
736 |
+ 010_all_coreutils-tests.patch |
737 |
+ 030_all_coreutils-more-dir-colors.patch |