* [gentoo-portage-dev] [PATCH] Do not try to source stray directories in bashrc paths
@ 2014-11-29 11:30 Michał Górny
2014-11-29 15:32 ` Zac Medico
0 siblings, 1 reply; 4+ messages in thread
From: Michał Górny @ 2014-11-29 11:30 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Michał Górny
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
--
2.1.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Do not try to source stray directories in bashrc paths
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
2014-11-29 19:26 ` Michał Górny
0 siblings, 1 reply; 4+ messages in thread
From: Zac Medico @ 2014-11-29 15:32 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Michał Górny
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [gentoo-portage-dev] [PATCH] Do not try to source stray directories in bashrc paths
2014-11-29 15:32 ` Zac Medico
@ 2014-11-29 19:26 ` Michał Górny
2014-11-29 19:45 ` Zac Medico
0 siblings, 1 reply; 4+ messages in thread
From: Michał Górny @ 2014-11-29 19:26 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Michał Górny
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..0de51f7 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 && -f $1 ]]; then
local debug_on=false
if [[ "$PORTAGE_DEBUG" == "1" ]] && [[ "${-/x/}" == "$-" ]]; then
debug_on=true
--
2.1.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Do not try to source stray directories in bashrc paths
2014-11-29 19:26 ` Michał Górny
@ 2014-11-29 19:45 ` Zac Medico
0 siblings, 0 replies; 4+ messages in thread
From: Zac Medico @ 2014-11-29 19:45 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Michał Górny
On 11/29/2014 11:26 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..0de51f7 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 && -f $1 ]]; then
> local debug_on=false
> if [[ "$PORTAGE_DEBUG" == "1" ]] && [[ "${-/x/}" == "$-" ]]; then
> debug_on=true
>
LGTM.
--
Thanks,
Zac
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-11-29 19:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-11-29 19:26 ` Michał Górny
2014-11-29 19:45 ` Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox