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.10: 003_all_coreutils-gentoo-uname.patch 010_all_coreutils-tests.patch 030_all_coreutils-more-dir-colors.patch README.history
Date: Sat, 05 Feb 2011 18:52:48
Message-Id: 20110205185238.B726C20054@flycatcher.gentoo.org
1 vapier 11/02/05 18:52:38
2
3 Added: 003_all_coreutils-gentoo-uname.patch
4 010_all_coreutils-tests.patch
5 030_all_coreutils-more-dir-colors.patch
6 README.history
7 Log:
8 initial 8.10 patchset based on last 8.9 patchset
9
10 Revision Changes Path
11 1.1 src/patchsets/coreutils/8.10/003_all_coreutils-gentoo-uname.patch
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.10/003_all_coreutils-gentoo-uname.patch?rev=1.1&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.10/003_all_coreutils-gentoo-uname.patch?rev=1.1&content-type=text/plain
15
16 Index: 003_all_coreutils-gentoo-uname.patch
17 ===================================================================
18 On linux platforms, grok /proc/cpuinfo for the CPU/vendor info.
19
20 Prob not suitable for upstream seeing as how it's 100% linux-specific
21 http://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00063.html
22
23 Patch originally by Carlos E. Gorges <carlos@×××××××××××××.br>, but
24 heavily reworked to suck less.
25
26 To add support for additional platforms, check out the show_cpuinfo()
27 func in the linux/arch/<ARCH>/ source tree of the kernel.
28
29 --- coreutils/src/uname.c
30 +++ coreutils/src/uname.c
31 @@ -50,6 +50,11 @@
32 # include <mach-o/arch.h>
33 #endif
34
35 +#if defined(__linux__)
36 +# define USE_PROCINFO
37 +# define UNAME_HARDWARE_PLATFORM
38 +#endif
39 +
40 #include "system.h"
41 #include "error.h"
42 #include "quote.h"
43 @@ -138,6 +143,117 @@
44 exit (status);
45 }
46
47 +#if defined(USE_PROCINFO)
48 +
49 +# if defined(__s390__) || defined(__s390x__)
50 +# define CPUINFO_FILE "/proc/sysinfo"
51 +# define CPUINFO_FORMAT "%64[^\t :]%*[ :]%256[^\n]%c"
52 +# else
53 +# define CPUINFO_FILE "/proc/cpuinfo"
54 +# define CPUINFO_FORMAT "%64[^\t:]\t:%256[^\n]%c"
55 +# endif
56 +
57 +# define PROCINFO_PROCESSOR 0
58 +# define PROCINFO_HARDWARE_PLATFORM 1
59 +
60 +static void __eat_cpuinfo_space(char *buf)
61 +{
62 + /* first eat trailing space */
63 + char *tmp = buf + strlen(buf) - 1;
64 + while (tmp > buf && isspace(*tmp))
65 + *tmp-- = '\0';
66 + /* then eat leading space */
67 + tmp = buf;
68 + while (*tmp && isspace(*tmp))
69 + tmp++;
70 + if (tmp != buf)
71 + memmove(buf, tmp, strlen(tmp)+1);
72 + /* finally collapse whitespace */
73 + tmp = buf;
74 + while (tmp[0] && tmp[1]) {
75 + if (isspace(tmp[0]) && isspace(tmp[1])) {
76 + memmove(tmp, tmp+1, strlen(tmp));
77 + continue;
78 + }
79 + ++tmp;
80 + }
81 +}
82 +
83 +static int __linux_procinfo(int x, char *fstr, size_t s)
84 +{
85 + FILE *fp;
86 +
87 + char *procinfo_keys[] = {
88 + /* --processor --hardware-platform */
89 + #if defined(__alpha__)
90 + "cpu model", "system type"
91 + #elif defined(__arm__)
92 + "Processor", "Hardware"
93 + #elif defined(__avr32__)
94 + "processor", "cpu family"
95 + #elif defined(__bfin__)
96 + "CPU", "BOARD Name"
97 + #elif defined(__cris__)
98 + "cpu", "cpu model"
99 + #elif defined(__frv__)
100 + "CPU-Core", "System"
101 + #elif defined(__i386__) || defined(__x86_64__)
102 + "model name", "vendor_id"
103 + #elif defined(__ia64__)
104 + "family", "vendor"
105 + #elif defined(__hppa__)
106 + "cpu", "model"
107 + #elif defined(__m68k__)
108 + "CPU", "MMU"
109 + #elif defined(__mips__)
110 + "cpu model", "system type"
111 + #elif defined(__powerpc__) || defined(__powerpc64__)
112 + "cpu", "machine"
113 + #elif defined(__s390__) || defined(__s390x__)
114 + "Type", "Manufacturer"
115 + #elif defined(__sh__)
116 + "cpu type", "machine"
117 + #elif defined(sparc) || defined(__sparc__)
118 + "type", "cpu"
119 + #elif defined(__vax__)
120 + "cpu type", "cpu"
121 + #else
122 + "unknown", "unknown"
123 + #endif
124 + };
125 +
126 + if ((fp = fopen(CPUINFO_FILE, "r")) != NULL) {
127 + char key[65], value[257], eol, *ret = NULL;
128 +
129 + while (fscanf(fp, CPUINFO_FORMAT, key, value, &eol) != EOF) {
130 + __eat_cpuinfo_space(key);
131 + if (!strcmp(key, procinfo_keys[x])) {
132 + __eat_cpuinfo_space(value);
133 + ret = value;
134 + break;
135 + }
136 + if (eol != '\n') {
137 + /* we need two fscanf's here in case the previous
138 + * length limit caused us to read right up to the
139 + * newline ... doing "%*[^\n]\n" wont eat the newline
140 + */
141 + fscanf(fp, "%*[^\n]");
142 + fscanf(fp, "\n");
143 + }
144 + }
145 + fclose(fp);
146 +
147 + if (ret) {
148 + strncpy(fstr, ret, s);
149 + return 0;
150 + }
151 + }
152 +
153 + return -1;
154 +}
155 +
156 +#endif
157 +
158 /* Print ELEMENT, preceded by a space if something has already been
159 printed. */
160
161 @@ -250,10 +344,14 @@ main (int argc, char **argv)
162 if (toprint & PRINT_PROCESSOR)
163 {
164 char const *element = unknown;
165 -#if HAVE_SYSINFO && defined SI_ARCHITECTURE
166 +#if ( HAVE_SYSINFO && defined SI_ARCHITECTURE ) || defined(USE_PROCINFO)
167 {
168 static char processor[257];
169 +#if defined(USE_PROCINFO)
170 + if (0 <= __linux_procinfo (PROCINFO_PROCESSOR, processor, sizeof processor))
171 +#else
172 if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
173 +#endif
174 element = processor;
175 }
176 #endif
177 @@ -306,9 +404,13 @@ main (int argc, char **argv)
178 if (element == unknown)
179 {
180 static char hardware_platform[257];
181 +#if defined(USE_PROCINFO)
182 + if (0 <= __linux_procinfo (PROCINFO_HARDWARE_PLATFORM, hardware_platform, sizeof hardware_platform))
183 +#else
184 size_t s = sizeof hardware_platform;
185 static int mib[] = { CTL_HW, UNAME_HARDWARE_PLATFORM };
186 if (sysctl (mib, 2, hardware_platform, &s, 0, 0) >= 0)
187 +#endif
188 element = hardware_platform;
189 }
190 #endif
191
192
193
194 1.1 src/patchsets/coreutils/8.10/010_all_coreutils-tests.patch
195
196 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.10/010_all_coreutils-tests.patch?rev=1.1&view=markup
197 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.10/010_all_coreutils-tests.patch?rev=1.1&content-type=text/plain
198
199 Index: 010_all_coreutils-tests.patch
200 ===================================================================
201 this test only gets run as non-root, so giving it temp write access to the
202 root dir is safe since normal unix access will deny it #259876
203 --- a/tests/touch/not-owner
204 +++ b/tests/touch/not-owner
205 @@ -39,6 +39,7 @@
206 # Before fileutils-4.1, we'd get the following misleading
207 # diagnostic instead of `...: Permission denied'.
208 # touch: creating `/': Is a directory
209 +env SANDBOX_WRITE=${SANDBOX_WRITE}:/ \
210 touch / > out 2>&1 && fail=1
211
212 # On SunOS4, EPERM is `Not owner'.
213
214 the dd test looks up a device and tries to test seeking on it. it shouldnt
215 cause any corruption because it uses a count of 0 and seeks past the end of
216 the device
217 --- a/tests/dd/skip-seek-past-dev
218 +++ b/tests/dd/skip-seek-past-dev
219 @@ -53,6 +53,7 @@
220 0+0 records out" > err_ok || framework_failure
221 compare err_ok err || fail=1
222
223 +env SANDBOX_WRITE=${SANDBOX_WRITE}:$device \
224 timeout 10 dd bs=1 seek=$DEV_OFLOW count=0 status=noxfer > "$device" 2> err
225 test "$?" = "1" || fail=1
226 echo "dd: \`standard output': cannot seek: Invalid argument
227
228
229
230 1.1 src/patchsets/coreutils/8.10/030_all_coreutils-more-dir-colors.patch
231
232 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.10/030_all_coreutils-more-dir-colors.patch?rev=1.1&view=markup
233 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.10/030_all_coreutils-more-dir-colors.patch?rev=1.1&content-type=text/plain
234
235 Index: 030_all_coreutils-more-dir-colors.patch
236 ===================================================================
237 --- coreutils-7.5/src/dircolors.hin
238 +++ coreutils-7.5/src/dircolors.hin
239 @@ -5,6 +5,9 @@
240
241 # The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
242 # slackware version of dircolors) are recognized but ignored.
243 +
244 +# You can copy this file to .dir_colors in your $HOME directory to override
245 +# the system defaults.
246
247 # Below, there should be one TERM entry for each termtype that is colorizable
248 TERM Eterm
249 @@ -66,7 +66,8 @@
250 DOOR 01;35 # door
251 BLK 40;33;01 # block device driver
252 CHR 40;33;01 # character device driver
253 -ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file
254 +ORPHAN 01;05;37;41 # orphaned syminks
255 +MISSING 01;05;37;41 # ... and the files they point to
256 SETUID 37;41 # file that is setuid (u+s)
257 SETGID 30;43 # file that is setgid (g+s)
258 STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
259 @@ -125,6 +154,16 @@
260 .xwd 01;35
261 .yuv 01;35
262
263 +# Document files
264 +.pdf 00;32
265 +.ps 00;32
266 +.txt 00;32
267 +.patch 00;32
268 +.diff 00;32
269 +.log 00;32
270 +.tex 00;32
271 +.doc 00;32
272 +
273 # audio formats
274 .aac 00;36
275 .au 00;36
276
277
278
279 1.1 src/patchsets/coreutils/8.10/README.history
280
281 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.10/README.history?rev=1.1&view=markup
282 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/coreutils/8.10/README.history?rev=1.1&content-type=text/plain
283
284 Index: README.history
285 ===================================================================
286 1 05.02.2011
287 + 003_all_coreutils-gentoo-uname.patch
288 + 010_all_coreutils-tests.patch
289 + 030_all_coreutils-more-dir-colors.patch