public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: Re: [gentoo-portage-dev] [PATCH] Do not try to source stray directories in bashrc paths
Date: Sat, 29 Nov 2014 07:32:09 -0800	[thread overview]
Message-ID: <5479E6F9.1050802@gentoo.org> (raw)
In-Reply-To: <1417260603-26312-1-git-send-email-mgorny@gentoo.org>

On 11/29/2014 03:30 AM, Michał Górny wrote:
> Check whether a particular bashrc path is not a directory before trying
> to source it. Avoids unnecessary 'is a directory' errors.
> ---
>  bin/ebuild.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/bin/ebuild.sh b/bin/ebuild.sh
> index 658884a..46c3a03 100755
> --- a/bin/ebuild.sh
> +++ b/bin/ebuild.sh
> @@ -421,7 +421,7 @@ __try_source() {
>  		qa=false
>  		shift
>  	fi
> -	if [[ -r "$1" ]]; then
> +	if [[ -r $1 && ! -d $1 ]]; then
>  		local debug_on=false
>  		if [[ "$PORTAGE_DEBUG" == "1" ]] && [[ "${-/x/}" == "$-" ]]; then
>  			debug_on=true
> 

LGTM. Maybe [[ -r $1 && -f $1 ]] makes more sense though, since anything
other that a regular file will simply not work here (-f returns true for
symlinks to regular files, too).
-- 
Thanks,
Zac


  reply	other threads:[~2014-11-29 15:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-29 11:30 [gentoo-portage-dev] [PATCH] Do not try to source stray directories in bashrc paths Michał Górny
2014-11-29 15:32 ` Zac Medico [this message]
2014-11-29 19:26   ` Michał Górny
2014-11-29 19:45     ` Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5479E6F9.1050802@gentoo.org \
    --to=zmedico@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    --cc=mgorny@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox