Gentoo Archives: gentoo-commits

From: "Doug Goldstein (cardoe)" <cardoe@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-apps/openrc/files/0.3.0: 0001-Fix-a-segfault-when-profile.env-does-not-exist.patch 0004-add-a-softlevel-function-to-the-API-so-people-dont.patch 0005-add-back-KV_-funcs.patch 0003-This-reverts-commit-0e2f160c95b15e95f3885e3f5a3670ec.patch 0002-kenv-is-not-always-available.patch
Date: Mon, 06 Oct 2008 16:56:53
Message-Id: E1KmtO7-0006j6-J2@stork.gentoo.org
1 cardoe 08/10/06 16:56:51
2
3 Added:
4 0001-Fix-a-segfault-when-profile.env-does-not-exist.patch
5 0004-add-a-softlevel-function-to-the-API-so-people-dont.patch
6 0005-add-back-KV_-funcs.patch
7 0003-This-reverts-commit-0e2f160c95b15e95f3885e3f5a3670ec.patch
8 0002-kenv-is-not-always-available.patch
9 Log:
10 version bump. forward port patches from 0.2.x and include some upstream fixes
11 (Portage version: 2.2_rc11/cvs/Linux 2.6.26-gentoo-r1 x86_64)
12
13 Revision Changes Path
14 1.1 sys-apps/openrc/files/0.3.0/0001-Fix-a-segfault-when-profile.env-does-not-exist.patch
15
16 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/openrc/files/0.3.0/0001-Fix-a-segfault-when-profile.env-does-not-exist.patch?rev=1.1&view=markup
17 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/openrc/files/0.3.0/0001-Fix-a-segfault-when-profile.env-does-not-exist.patch?rev=1.1&content-type=text/plain
18
19 Index: 0001-Fix-a-segfault-when-profile.env-does-not-exist.patch
20 ===================================================================
21 From 908a084d0ed193f6ec1b4017438cb4bbf3814b7f Mon Sep 17 00:00:00 2001
22 From: Roy Marples <roy@××××××××××××××.name>
23 Date: Fri, 3 Oct 2008 18:50:10 +0100
24 Subject: [PATCH] Fix a segfault when profile.env does not exist.
25
26 ---
27 src/rc/rc-misc.c | 17 +++++++++--------
28 1 files changed, 9 insertions(+), 8 deletions(-)
29
30 diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c
31 index d94cd2e..d4b3ca0 100644
32 --- a/src/rc/rc-misc.c
33 +++ b/src/rc/rc-misc.c
34 @@ -128,13 +128,13 @@ void env_filter(void)
35 size_t i = 0;
36
37 /* Add the user defined list of vars */
38 - env_allow = rc_stringlist_split(rc_conf_value ("rc_env_allow"), " ");
39 + env_allow = rc_stringlist_split(rc_conf_value("rc_env_allow"), " ");
40 if (exists(PROFILE_ENV))
41 profile = rc_config_load(PROFILE_ENV);
42
43 /* Copy the env and work from this so we can manipulate it safely */
44 env_list = rc_stringlist_new();
45 - while (environ[i]) {
46 + while (environ && environ[i]) {
47 env = rc_stringlist_add(env_list, environ[i++]);
48 e = strchr(env->value, '=');
49 if (e)
50 @@ -159,14 +159,15 @@ void env_filter(void)
51 }
52
53 /* Now add anything missing from the profile */
54 - TAILQ_FOREACH(env, profile, entries) {
55 - e = strchr(env->value, '=');
56 - *e = '\0';
57 - if (!getenv(env->value))
58 - setenv(env->value, e + 1, 1);
59 + if (profile) {
60 + TAILQ_FOREACH(env, profile, entries) {
61 + e = strchr(env->value, '=');
62 + *e = '\0';
63 + if (!getenv(env->value))
64 + setenv(env->value, e + 1, 1);
65 + }
66 }
67
68 -
69 rc_stringlist_free(env_list);
70 rc_stringlist_free(env_allow);
71 rc_stringlist_free(profile);
72 --
73 1.6.0.2
74
75
76
77
78 1.1 sys-apps/openrc/files/0.3.0/0004-add-a-softlevel-function-to-the-API-so-people-dont.patch
79
80 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/openrc/files/0.3.0/0004-add-a-softlevel-function-to-the-API-so-people-dont.patch?rev=1.1&view=markup
81 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/openrc/files/0.3.0/0004-add-a-softlevel-function-to-the-API-so-people-dont.patch?rev=1.1&content-type=text/plain
82
83 Index: 0004-add-a-softlevel-function-to-the-API-so-people-dont.patch
84 ===================================================================
85 From 79e8ce8d2ea0ede99aba18d5f9a625a110aa918f Mon Sep 17 00:00:00 2001
86 From: Mike Frysinger <vapier@g.o>
87 Date: Mon, 24 Mar 2008 02:03:39 -0400
88 Subject: [PATCH] add a softlevel() function to the API so people dont have to worry about inner details and move get_bootparam back to the exported function.sh api
89
90 ---
91 sh/functions.sh.in | 22 ++++++++++++++++++++++
92 sh/rc-functions.sh.in | 23 -----------------------
93 2 files changed, 22 insertions(+), 23 deletions(-)
94
95 diff --git a/sh/functions.sh.in b/sh/functions.sh.in
96 index 57917ed..680f534 100644
97 --- a/sh/functions.sh.in
98 +++ b/sh/functions.sh.in
99 @@ -42,6 +42,28 @@ rc_runlevel() {
100 rc-status --runlevel
101 }
102
103 +get_bootparam()
104 +{
105 + local match="$1"
106 + [ -z "${match}" -o ! -r /proc/cmdline ] && return 1
107 +
108 + set -- $(cat /proc/cmdline)
109 + while [ -n "$1" ]; do
110 + case "$1" in
111 + gentoo=*)
112 + local params="${1##*=}"
113 + local IFS=, x=
114 + for x in ${params}; do
115 + [ "${x}" = "${match}" ] && return 0
116 + done
117 + ;;
118 + esac
119 + shift
120 + done
121 +
122 + return 1
123 +}
124 +
125 _sanitize_path()
126 {
127 local IFS=":" p= path=
128 diff --git a/sh/rc-functions.sh.in b/sh/rc-functions.sh.in
129 index 751d47a..c713def 100644
130 --- a/sh/rc-functions.sh.in
131 +++ b/sh/rc-functions.sh.in
132 @@ -51,29 +51,6 @@ is_union_fs()
133 unionctl "$1" --list >/dev/null 2>&1
134 }
135
136 -get_bootparam()
137 -{
138 - local match="$1"
139 - [ -z "${match}" -o ! -r /proc/cmdline ] && return 1
140 -
141 - set -- $(cat /proc/cmdline)
142 - while [ -n "$1" ]; do
143 - [ "$1" = "${match}" ] && return 0
144 - case "$1" in
145 - gentoo=*)
146 - local params="${1##*=}"
147 - local IFS=, x=
148 - for x in ${params}; do
149 - [ "${x}" = "${match}" ] && return 0
150 - done
151 - ;;
152 - esac
153 - shift
154 - done
155 -
156 - return 1
157 -}
158 -
159 # Add our sbin to $PATH
160 case "${PATH}" in
161 "${RC_LIBDIR}"/sbin|"${RC_LIBDIR}"/sbin:*);;
162 --
163 1.6.0.2
164
165
166
167
168 1.1 sys-apps/openrc/files/0.3.0/0005-add-back-KV_-funcs.patch
169
170 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/openrc/files/0.3.0/0005-add-back-KV_-funcs.patch?rev=1.1&view=markup
171 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/openrc/files/0.3.0/0005-add-back-KV_-funcs.patch?rev=1.1&content-type=text/plain
172
173 Index: 0005-add-back-KV_-funcs.patch
174 ===================================================================
175 From 77a1fb72523df6495ae526fbf4fd834ac15aae74 Mon Sep 17 00:00:00 2001
176 From: Mike Frysinger <vapier@g.o>
177 Date: Mon, 24 Mar 2008 03:14:02 -0400
178 Subject: [PATCH] add back KV_* funcs
179
180 ---
181 sh/functions.sh.in | 35 +++++++++++++++++++++++++++++++++++
182 sh/runtests.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++
183 2 files changed, 80 insertions(+), 0 deletions(-)
184
185 diff --git a/sh/functions.sh.in b/sh/functions.sh.in
186 index 680f534..f121564 100644
187 --- a/sh/functions.sh.in
188 +++ b/sh/functions.sh.in
189 @@ -64,6 +64,41 @@ get_bootparam()
190 return 1
191 }
192
193 +KV_major() {
194 + [ -z "$*" ] && return 1
195 + local KV="$*"
196 + echo ${KV%%.*}
197 +}
198 +
199 +KV_minor() {
200 + [ -z "$*" ] && return 1
201 + local KV="$*"
202 + KV=${KV#*.}
203 + echo ${KV%%.*}
204 +}
205 +
206 +KV_micro() {
207 + [ -z "$*" ] && return 1
208 + local KV="$*"
209 + KV=${KV#*.*.}
210 + echo ${KV%%[![:digit:]]*}
211 +}
212 +
213 +KV_to_int() {
214 + [ -z "$*" ] && return 1
215 + local KV_MAJOR="$(KV_major "$*")"
216 + local KV_MINOR="$(KV_minor "$*")"
217 + local KV_MICRO="$(KV_micro "$*")"
218 + local KV_int="$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))"
219 + echo "${KV_int}"
220 +}
221 +
222 +_RC_GET_KV_CACHE=""
223 +get_KV() {
224 + [ -z ${_RC_GET_KV_CACHE} ] && _RC_GET_KV_CACHE=$(uname -r)
225 + echo $(KV_to_int "${_RC_GET_KV_CACHE}")
226 +}
227 +
228 _sanitize_path()
229 {
230 local IFS=":" p= path=
231 diff --git a/sh/runtests.sh b/sh/runtests.sh
232 index 110266b..9f6726d 100755
233 --- a/sh/runtests.sh
234 +++ b/sh/runtests.sh
235 @@ -3,6 +3,19 @@
236 top_srcdir=${top_srcdir:-..}
237 . ${top_srcdir}/test/setup_env.sh
238
239 +checkit() {
240 + local output=$($1 $3)
241 + local lret=$?
242 + if [ ${lret} -ne 0 ] ; then
243 + ((tret+=lret))
244 + echo "FAIL: exec: $*"
245 + fi
246 + if [ "${output}" != "$2" ] ; then
247 + ((tret+=lret))
248 + echo "FAIL: output: $* : got='${output}' wanted='$2'"
249 + fi
250 +}
251 +
252 ret=0
253
254 tret=0
255 @@ -22,4 +35,36 @@ done
256 eend ${tret}
257 ret=$((${ret} + ${tret}))
258
259 +compare_int() {
260 + local got=$(KV_to_int $1)
261 + local exp=$(KV_to_int $3)
262 + if ! [ ${got} $2 ${exp} ] ; then
263 + ((tret+=1))
264 + echo "FAIL: KV_to_int '${v}'(${got}) $2 '1.2.2'(${exp})"
265 + fi
266 +}
267 +
268 +tret=0
269 +ebegin "Testing KV_{major,minor,micro,to_int}"
270 +for v in \
271 + 1.2.3 1.2.3-rc0 1.2.3_rc0 "1.2.3 rc0" \
272 + 1.2.3.4 1.2.3.4-rc0 1.2.3.4_rc0 "1.2.3.4 rc0"
273 +do
274 + checkit KV_major 1 ${v}
275 + checkit KV_minor 2 ${v}
276 + checkit KV_micro 3 ${v}
277 +
278 + compare_int 1.2.2 -lt ${v}
279 + compare_int 1.2.2.10 -lt ${v}
280 + compare_int 1.2.4 -gt ${v}
281 + compare_int 1.2.4-rc0 -gt ${v}
282 + compare_int 1.2.3 -eq ${v}
283 + compare_int 1.2.3-rc0 -eq ${v}
284 + compare_int 1.2.3.2 -eq ${v}
285 + compare_int 1.2.3.3 -eq ${v}
286 + compare_int 1.2.3.4 -eq ${v}
287 +done
288 +eend ${tret}
289 +((ret+=tret))
290 +
291 exit ${ret}
292 --
293 1.6.0.2
294
295
296
297
298 1.1 sys-apps/openrc/files/0.3.0/0003-This-reverts-commit-0e2f160c95b15e95f3885e3f5a3670ec.patch
299
300 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/openrc/files/0.3.0/0003-This-reverts-commit-0e2f160c95b15e95f3885e3f5a3670ec.patch?rev=1.1&view=markup
301 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/openrc/files/0.3.0/0003-This-reverts-commit-0e2f160c95b15e95f3885e3f5a3670ec.patch?rev=1.1&content-type=text/plain
302
303 Index: 0003-This-reverts-commit-0e2f160c95b15e95f3885e3f5a3670ec.patch
304 ===================================================================
305 From ce2effcad208d2fdc6126811ac7127fdc928e823 Mon Sep 17 00:00:00 2001
306 From: Mike Frysinger <vapier@g.o>
307 Date: Mon, 24 Mar 2008 01:48:19 -0400
308 Subject: [PATCH] This reverts commit 0e2f160c95b15e95f3885e3f5a3670ec5ae0a709. 2 spaces in 80 cols has never made any sort of realistic difference and we're not going to change this behavior in Gentoo.
309
310 ---
311 src/libeinfo/libeinfo.c | 9 +++------
312 1 files changed, 3 insertions(+), 6 deletions(-)
313
314 diff --git a/src/libeinfo/libeinfo.c b/src/libeinfo/libeinfo.c
315 index bef98a5..a5977b7 100644
316 --- a/src/libeinfo/libeinfo.c
317 +++ b/src/libeinfo/libeinfo.c
318 @@ -764,7 +764,7 @@ _eend(FILE * __EINFO_RESTRICT fp, int col, ECOLOR color, const char *msg)
319 if (!msg)
320 return;
321
322 - cols = get_term_columns(fp) - (strlen(msg) + 3);
323 + cols = get_term_columns(fp) - (strlen(msg) + 5);
324
325 /* cons25 is special - we need to remove one char, otherwise things
326 * do not align properly at all. */
327 @@ -778,18 +778,15 @@ _eend(FILE * __EINFO_RESTRICT fp, int col, ECOLOR color, const char *msg)
328 if (term_is_cons25)
329 cols--;
330
331 - /* If extra spacing is required around msg, then please change
332 - * via a runtime knob and leave this default as is as it saves 2
333 - * valuable columns when running on 80 column screens. */
334 if (cols > 0 && colour_terminal(fp)) {
335 - fprintf(fp, "%s%s %s[%s%s%s]%s\n", up, tgoto(goto_column, 0, cols),
336 + fprintf(fp, "%s%s %s[%s %s %s]%s\n", up, tgoto(goto_column, 0, cols),
337 ecolor(ECOLOR_BRACKET), ecolor(color), msg,
338 ecolor(ECOLOR_BRACKET), ecolor(ECOLOR_NORMAL));
339 } else {
340 if (col > 0)
341 for (i = 0; i < cols - col; i++)
342 fprintf(fp, " ");
343 - fprintf(fp, " [%s]\n", msg);
344 + fprintf(fp, " [ %s ]\n", msg);
345 }
346 }
347
348 --
349 1.6.0.2
350
351
352
353
354 1.1 sys-apps/openrc/files/0.3.0/0002-kenv-is-not-always-available.patch
355
356 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/openrc/files/0.3.0/0002-kenv-is-not-always-available.patch?rev=1.1&view=markup
357 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/openrc/files/0.3.0/0002-kenv-is-not-always-available.patch?rev=1.1&content-type=text/plain
358
359 Index: 0002-kenv-is-not-always-available.patch
360 ===================================================================
361 From 19f8761365b825ae9949559048afd90c2f662de8 Mon Sep 17 00:00:00 2001
362 From: Roy Marples <roy@××××××××××××××.name>
363 Date: Fri, 3 Oct 2008 18:50:30 +0100
364 Subject: [PATCH] kenv is not always available.
365
366 ---
367 init.d/hostid.in | 8 +++++---
368 1 files changed, 5 insertions(+), 3 deletions(-)
369
370 diff --git a/init.d/hostid.in b/init.d/hostid.in
371 index a058884..584fd2d 100644
372 --- a/init.d/hostid.in
373 +++ b/init.d/hostid.in
374 @@ -38,9 +38,11 @@ _set()
375 # otherwise we generate a random UUID.
376 reset()
377 {
378 - local uuid=$(kenv smbios.system.uuid 2>/dev/null)
379 - local x="[0-9a-f]"
380 - local y="${x}${x}${x}${x}"
381 + local uuid= x="[0-9a-f]" y="${x}${x}${x}${x}"
382 +
383 + if type kenv >/dev/null 2>&1; then
384 + uuid=$(kenv smbios.system.uuid 2>/dev/null)
385 + fi
386 case "${uuid}" in
387 ${y}${y}-${y}-${y}-${y}-${y}${y}${y});;
388 *) uuid=;;
389 --
390 1.6.0.2