From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id AEAF2138806 for ; Mon, 25 Dec 2017 11:00:42 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B179AE0DEE; Mon, 25 Dec 2017 11:00:40 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 853A0E0DEE for ; Mon, 25 Dec 2017 11:00:40 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5941633DDA5 for ; Mon, 25 Dec 2017 11:00:39 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A5432AE93 for ; Mon, 25 Dec 2017 11:00:37 +0000 (UTC) From: "Ulrich Müller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Müller" Message-ID: <1514194826.b4cf6bfdc8ad3908637f5ab068f6c323bb32fe6b.ulm@gentoo> Subject: [gentoo-commits] proj/eselect:master commit in: /, modules/ X-VCS-Repository: proj/eselect X-VCS-Files: ChangeLog modules/news.eselect X-VCS-Directories: / modules/ X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Müller X-VCS-Revision: b4cf6bfdc8ad3908637f5ab068f6c323bb32fe6b X-VCS-Branch: master Date: Mon, 25 Dec 2017 11:00:37 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 9c5f0962-1737-4407-889d-53b28dedd455 X-Archives-Hash: 41c0d44723e1d2981d6398e52b36fb7b commit: b4cf6bfdc8ad3908637f5ab068f6c323bb32fe6b Author: Ulrich Müller gentoo org> AuthorDate: Mon Dec 25 09:40:26 2017 +0000 Commit: Ulrich Müller gentoo org> CommitDate: Mon Dec 25 09:40:26 2017 +0000 URL: https://gitweb.gentoo.org/proj/eselect.git/commit/?id=b4cf6bfd Check for valid news item format. * modules/news.eselect (do_list): Check for valid news item format. ChangeLog | 2 ++ modules/news.eselect | 30 ++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 648e874..55e5bb4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2017-12-25 Ulrich Müller + * modules/news.eselect (do_list): Check for valid news item format. + * libs/core.bash.in (eval): Make it fatal again, after more than one year of transition time. diff --git a/modules/news.eselect b/modules/news.eselect index 15cf985..b0e9695 100644 --- a/modules/news.eselect +++ b/modules/news.eselect @@ -172,7 +172,7 @@ describe_list() { } do_list() { - local item stat repo dir header line title posted i=1 + local item stat repo dir header line format title posted i=1 local cols=${COLUMNS:-80} ifs_save=${IFS} local -a repos dirs @@ -185,16 +185,26 @@ do_list() { title="(${item} - no title)" posted=${item:0:10} [[ ${posted} == +([0-9])-+([0-9])-+([0-9]) ]] || posted="(no date) " - header=$(read_item "${dir}" "${item}" header) \ - || title="(${item} - removed?)" - local IFS=$'\n' - for line in ${header}; do - case "${line%%:*}" in - Title) title=${line##*([^:]):*([[:space:]])} ;; - Posted) posted=${line##*([^:]):*([[:space:]])} ;; + if header=$(read_item "${dir}" "${item}" header); then + local IFS=$'\n' + for line in ${header}; do + case "${line%%:*}" in + Title) title=${line##*([^:]):*([[:space:]])} ;; + Posted) posted=${line##*([^:]):*([[:space:]])} ;; + News-Item-Format) format=${line##*([^:]):*([[:space:]])} ;; + esac + done + IFS=${ifs_save} + case ${format} in + 1.*|2.*) ;; + *) + title="(${item} - unknown format ${format})" + posted="" + ;; esac - done - IFS=${ifs_save} + else + title="(${item} - removed?)" + fi [[ ${repo} != gentoo ]] && title="[${repo}] ${title}" line="${posted}$(space $((10 - ${#posted}))) ${title}" # truncate the line if it is too long