1 |
Author: zmedico |
2 |
Date: 2010-01-29 18:43:41 +0000 (Fri, 29 Jan 2010) |
3 |
New Revision: 15226 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.7/bin/ebuild-helpers/doins |
7 |
Log: |
8 |
Bug #299248 - Fix doins return code handling to make sure it always fails |
9 |
when appropriate. Thanks to Jonathan Callen <abcd@g.o> for the initial |
10 |
patch. (trunk r15158) |
11 |
|
12 |
Modified: main/branches/2.1.7/bin/ebuild-helpers/doins |
13 |
=================================================================== |
14 |
--- main/branches/2.1.7/bin/ebuild-helpers/doins 2010-01-29 18:43:31 UTC (rev 15225) |
15 |
+++ main/branches/2.1.7/bin/ebuild-helpers/doins 2010-01-29 18:43:41 UTC (rev 15226) |
16 |
@@ -63,12 +63,20 @@ |
17 |
} |
18 |
|
19 |
_xdoins() { |
20 |
+ local -i success=0 failed=0 |
21 |
while read -d $'\0' x ; do |
22 |
_doins "$x" "${x%/*}" |
23 |
+ if [[ $? -eq 0 ]] ; then |
24 |
+ ((success|=1)) |
25 |
+ else |
26 |
+ ((failed|=1)) |
27 |
+ fi |
28 |
done |
29 |
+ [[ $failed -ne 0 || $success -eq 0 ]] && return 1 || return 0 |
30 |
} |
31 |
|
32 |
success=0 |
33 |
+failed=0 |
34 |
|
35 |
for x in "$@" ; do |
36 |
if [[ $PRESERVE_SYMLINKS = n && -d $x ]] || \ |
37 |
@@ -100,15 +108,24 @@ |
38 |
fi |
39 |
find "$x_orig" -type d -exec dodir "${INSDESTTREE}/{}" \; |
40 |
find "$x_orig" \( -type f -or -type l \) -print0 | _xdoins |
41 |
+ if [[ ${PIPESTATUS[1]} -eq 0 ]] ; then |
42 |
+ ((success|=1)) |
43 |
+ else |
44 |
+ ((failed|=1)) |
45 |
+ fi |
46 |
if [[ $x != $x_orig ]] ; then |
47 |
popd >/dev/null |
48 |
mv "$TMP/1/$x_orig" "$x" |
49 |
fi |
50 |
while popd >/dev/null 2>&1 ; do true ; done |
51 |
- ((success|=1)) |
52 |
else |
53 |
- _doins "${x}" && ((success|=1)) |
54 |
+ _doins "${x}" |
55 |
+ if [[ $? -eq 0 ]] ; then |
56 |
+ ((success|=1)) |
57 |
+ else |
58 |
+ ((failed|=1)) |
59 |
+ fi |
60 |
fi |
61 |
done |
62 |
rm -rf "$TMP" |
63 |
-[ $success -gt 0 ] && exit 0 || exit 1 |
64 |
+[[ $failed -ne 0 || $success -eq 0 ]] && exit 1 || exit 0 |