commit:     24b7b6c3026e62b519922cf81074594fbd573ef8
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sun Dec  4 05:38:54 2016 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sun Dec  4 12:22:01 2016 +0000
URL:        https://gitweb.gentoo.org/proj/eselect.git/commit/?id=24b7b6c3

Check return status of package manager calls in news module.

* modules/news.eselect (find_items, find_repo_dir): Check return
status of package manager calls, bug 601506.

 ChangeLog            | 5 +++++
 modules/news.eselect | 8 ++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 80bc483..4d12473 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-12-04  Ulrich Müller  <u...@gentoo.org>
+
+       * modules/news.eselect (find_items, find_repo_dir): Check return
+       status of package manager calls, bug 601506.
+
 2016-10-31  Ulrich Müller  <u...@gentoo.org>
 
        * libs/core.bash.in (eval): Disable eval again, because the

diff --git a/modules/news.eselect b/modules/news.eselect
index e413706..1c6a981 100644
--- a/modules/news.eselect
+++ b/modules/news.eselect
@@ -14,7 +14,10 @@ NEWS_DIR="/var/lib/gentoo/news"
 # returns one item per line: status/repository/name
 # sort order: by item name (i.e. effectively by date)
 find_items() {
-       local stat repos=$(get_repositories) repo file item
+       local stat repos repo file item
+       repos=$(get_repositories) \
+               || die "Package manager cannot get list of repositories"
+       [[ -n ${repos} ]] || write_warning_msg "No repositories found"
        for stat; do
                for repo in ${repos}; do
                        file="${EROOT}${NEWS_DIR}/news-${repo}.${stat}"
@@ -80,7 +83,8 @@ find_repo_dir() {
        done
        if [[ ${i} -eq ${#repos[@]} ]]; then
                repos[i]=${repo}
-               dirs[i]=$(get_repo_news_dir "${repo}")
+               dirs[i]=$(get_repo_news_dir "${repo}") \
+                       || die "Package manager cannot get news dir for repo 
${repo}"
        fi
        dir=${dirs[i]}
 }

Reply via email to