aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rwxr-xr-xbin/eselect.in5
-rw-r--r--libs/core.bash.in5
3 files changed, 16 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 85e0b6e..c24a5fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-01-13 Ulrich Müller <ulm@gentoo.org>
+
+ * bin/eselect.in (ESELECT_STDERR): Save stderr file descriptor.
+ * libs/core.bash.in (die): Restore stderr, otherwise there would
+ be no output if die was called while stderr is redirected.
+ Fixes bug 451150. Thanks to Michał Górny <mgorny@gentoo.org>.
+
2013-01-06 Ulrich Müller <ulm@gentoo.org>
* configure.ac: Update version to 1.3.4.
diff --git a/bin/eselect.in b/bin/eselect.in
index 3f99f95..8fd1589 100755
--- a/bin/eselect.in
+++ b/bin/eselect.in
@@ -55,6 +55,11 @@ IFS=$' \t\n'
shopt -s extglob
shopt -s expand_aliases
+# Save stderr file descriptor
+# exec {ESELECT_STDERR}>&2 # >=bash-4.1
+exec 3>&2
+ESELECT_STDERR=3
+
# Load core functions
source "${ESELECT_CORE_PATH}/core.bash" || exit 255
# Load necessary functions for the main script
diff --git a/libs/core.bash.in b/libs/core.bash.in
index 90b6621..fe174d1 100644
--- a/libs/core.bash.in
+++ b/libs/core.bash.in
@@ -32,6 +32,9 @@ check_do() {
die() {
local item funcname="" sourcefile="" lineno="" n e s="yes"
+ # Restore stderr if it was redirected
+ exec 2>&${ESELECT_STDERR}
+
# do we have a working write_error_msg?
if is_function "write_error_msg"; then
e="write_error_msg"
@@ -45,7 +48,7 @@ die() {
shift
fi
- $e "${@:-(no message)}"
+ $e "${@:-(no message)}" >&2
if [[ -n ${s} ]]; then
echo "Call stack:" >&2