Gentoo Archives: gentoo-portage-dev

From: Fabian Groffen <grobian@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Fabian Groffen <grobian@g.o>
Subject: [gentoo-portage-dev] [PATCH] etc-update: fix hang when using_editor is set, bug #544440
Date: Wed, 22 Feb 2017 19:10:00
Message-Id: 20170222191007.96151-1-grobian@gentoo.org
1 Don't try to use an interactive editor to obtain the difference between
2 files. Fall back to plain `diff -q` in this case.
3 ---
4 bin/etc-update | 19 +++++++++++++++----
5 1 file changed, 15 insertions(+), 4 deletions(-)
6
7 diff --git a/bin/etc-update b/bin/etc-update
8 index e0f7224dc..ea69f1478 100755
9 --- a/bin/etc-update
10 +++ b/bin/etc-update
11 @@ -649,10 +649,21 @@ do_distconf() {
12 elif [[ -L ${efile} || -L ${file} ]] ; then
13 # not the same file types
14 continue
15 - elif diff_command "${file}" "${efile}" &> /dev/null; then
16 - # replace identical copy
17 - mv "${file}" "${efile}"
18 - break
19 + else
20 + local ret=
21 + if [[ ${using_editor} == 0 ]] ; then
22 + diff_command "${file}" "${efile}" &> /dev/null
23 + ret=$?
24 + else
25 + # fall back to plain diff
26 + diff -q "${file}" "${efile}" &> /dev/null
27 + ret=$?
28 + fi
29 + if [[ ${ret} == 0 ]] ; then
30 + # replace identical copy
31 + mv "${file}" "${efile}"
32 + break
33 + fi
34 fi
35 done
36 }
37 --
38 2.11.1

Replies