From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id EF19A58975 for ; Wed, 3 Feb 2016 18:52:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3FC3B21C057; Wed, 3 Feb 2016 18:52:08 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 68D9621C03C for ; Wed, 3 Feb 2016 18:52:07 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A62EB340A51 for ; Wed, 3 Feb 2016 18:52:06 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id CFC91CEC for ; Wed, 3 Feb 2016 18:52:02 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1454525501.747857408315deb4b6a0ddd2a34484ca8e5ec2ff.vapier@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: app-shells/bash/files/bashrc X-VCS-Directories: app-shells/bash/files/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 747857408315deb4b6a0ddd2a34484ca8e5ec2ff X-VCS-Branch: master Date: Wed, 3 Feb 2016 18:52:02 +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: 7c35b5fa-adaa-4e81-9f9e-99e135de857d X-Archives-Hash: 959b08a392064e3ddfda8e72b27284ce commit: 747857408315deb4b6a0ddd2a34484ca8e5ec2ff Author: Mike Frysinger gentoo org> AuthorDate: Tue Feb 2 22:08:19 2016 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Wed Feb 3 18:51:41 2016 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=74785740 app-shells/bash: bashrc: drop custom parsing of dircolors databases #572582 Starting with coreutils-8.24, the dircolors TERM entries are run through fnmatch rather than being a plain text string. This means our parsing logic no longer works because we assumed fixed strings. It isn't easy to process a list of path globs in bash, so rework the code to always run the dircolors tool. We were doing this anyways in the majority of cases, so it's not like we're adding that much overhead. The only people who are negatively impacted are interactive colorless terminals. Reported-by: Bernd Feige gmx.net> app-shells/bash/files/bashrc | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/app-shells/bash/files/bashrc b/app-shells/bash/files/bashrc index c5b449b..414f848 100644 --- a/app-shells/bash/files/bashrc +++ b/app-shells/bash/files/bashrc @@ -52,27 +52,19 @@ esac # Set colorful PS1 only on colorful terminals. # dircolors --print-database uses its own built-in database # instead of using /etc/DIR_COLORS. Try to use the external file -# first to take advantage of user additions. Use internal bash -# globbing instead of external grep binary. +# first to take advantage of user additions. use_color=false -safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM -match_lhs="" -[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)" -[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(/dev/null \ - && match_lhs=$(dircolors --print-database) -[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true - -if ${use_color} ; then +if type -P dircolors >/dev/null ; then # Enable colors for ls, etc. Prefer ~/.dir_colors #64489 - if type -P dircolors >/dev/null ; then - if [[ -f ~/.dir_colors ]] ; then - eval "$(dircolors -b ~/.dir_colors)" - elif [[ -f /etc/DIR_COLORS ]] ; then - eval "$(dircolors -b /etc/DIR_COLORS)" - fi + LS_COLORS= + if [[ -f ~/.dir_colors ]] ; then + eval "$(dircolors -b ~/.dir_colors)" + elif [[ -f /etc/DIR_COLORS ]] ; then + eval "$(dircolors -b /etc/DIR_COLORS)" + else + eval "$(dircolors -b)" fi + [[ -n ${LS_COLORS:+set} ]] && use_color=true else # Some systems (e.g. BSD & embedded) don't typically come with # dircolors so we need to hardcode some terminals in here. @@ -107,4 +99,4 @@ for sh in /etc/bash/bashrc.d/* ; do done # Try to keep environment pollution down, EPA loves us. -unset use_color safe_term match_lhs sh +unset use_color sh