Re: [gentoo-portage-dev] [PATCH] etc-update: fix hang when using_editor is set, bug #544440

2017-02-22 Thread Zac Medico
On 02/22/2017 11:10 AM, Fabian Groffen wrote:
> Don't try to use an interactive editor to obtain the difference between
> files.  Fall back to plain `diff -q` in this case.
> ---
>  bin/etc-update | 19 +++
>  1 file changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/bin/etc-update b/bin/etc-update
> index e0f7224dc..ea69f1478 100755
> --- a/bin/etc-update
> +++ b/bin/etc-update
> @@ -649,10 +649,21 @@ do_distconf() {
>   elif [[ -L ${efile} || -L ${file} ]] ; then
>   # not the same file types
>   continue
> - elif diff_command "${file}" "${efile}" &> /dev/null; then
> - # replace identical copy
> - mv "${file}" "${efile}"
> - break
> + else
> + local ret=
> + if [[ ${using_editor} == 0 ]] ; then
> + diff_command "${file}" "${efile}" &> /dev/null
> + ret=$?
> + else
> + # fall back to plain diff
> + diff -q "${file}" "${efile}" &> /dev/null
> + ret=$?
> + fi
> + if [[ ${ret} == 0 ]] ; then
> + # replace identical copy
> + mv "${file}" "${efile}"
> + break
> + fi
>   fi
>   done
>  }
> 

Looks good. Merged:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=246373bbe52c55e912381d8555cceb70db0ec41b
-- 
Thanks,
Zac



[gentoo-portage-dev] [PATCH] etc-update: fix hang when using_editor is set, bug #544440

2017-02-22 Thread Fabian Groffen
Don't try to use an interactive editor to obtain the difference between
files.  Fall back to plain `diff -q` in this case.
---
 bin/etc-update | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/bin/etc-update b/bin/etc-update
index e0f7224dc..ea69f1478 100755
--- a/bin/etc-update
+++ b/bin/etc-update
@@ -649,10 +649,21 @@ do_distconf() {
elif [[ -L ${efile} || -L ${file} ]] ; then
# not the same file types
continue
-   elif diff_command "${file}" "${efile}" &> /dev/null; then
-   # replace identical copy
-   mv "${file}" "${efile}"
-   break
+   else
+   local ret=
+   if [[ ${using_editor} == 0 ]] ; then
+   diff_command "${file}" "${efile}" &> /dev/null
+   ret=$?
+   else
+   # fall back to plain diff
+   diff -q "${file}" "${efile}" &> /dev/null
+   ret=$?
+   fi
+   if [[ ${ret} == 0 ]] ; then
+   # replace identical copy
+   mv "${file}" "${efile}"
+   break
+   fi
fi
done
 }
-- 
2.11.1