Re: [PATCH] Fix tests when using bash_completion

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] Fix tests when using bash_completion

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:06

Julian Phillips [off-list ref] writes:
(I'm not the only one who thinks CDPATH is ick am I? :S)
CDPATH is Ok as long as it stays as an interactive shell
variable.

Sadly, if you google for "CDPATH environment", you would see
many many hits.  That variable is not meant to be used as an
environment variable.

Something like this in .bashrc is acceptable:

	case "$PS1" in
        '')
        	;; # do not do useless thing for noninteractive
	?*)
        	CDPATH=my:favorite:path
                . $HOME/.bash-completion
		;;
	esac

but people usually are way too careless than that and export
CDPATH to the environment, and that is where breakages start.

[OT] CDPATH (was: Re: [PATCH] Fix tests when using bash_completion)

From: Julian Phillips <hidden>
Date: 2016-06-15 22:43:06

On Mon, 23 Apr 2007, Junio C Hamano wrote:
Julian Phillips [off-list ref] writes:
quoted
(I'm not the only one who thinks CDPATH is ick am I? :S)
CDPATH is Ok as long as it stays as an interactive shell
variable.

Sadly, if you google for "CDPATH environment", you would see
many many hits.  That variable is not meant to be used as an
environment variable.
True - though personally I tend to use more discriminate shell functions 
anyway.
Something like this in .bashrc is acceptable:

	case "$PS1" in
       '')
       	;; # do not do useless thing for noninteractive
	?*)
       	CDPATH=my:favorite:path
               . $HOME/.bash-completion
		;;
	esac

but people usually are way too careless than that and export
CDPATH to the environment, and that is where breakages start.
I guess part of the problem is that a lot of these people don't actually 
understand the difference between shell variables and environment 
variables, or why the distinction is useful.  Plenty of people seem to do 
"export FOO=..." by rote.

-- 
Julian

  ---
Anyone can hold the helm when the sea is calm.
 		-- Publius Syrus

RE: [OT] CDPATH

From: Ron Parker <hidden>
Date: 2016-06-15 22:43:06

Junio C Hamano [off-list ref] wrote:
Are you sure bash-completion is the culprit, not your CDPATH?
Sorry, I was half-asleep yesterday.  Of course it was CDPATH and not 
bash-completion.

Julian Phillips [off-list ref] wrote:
CDPATH is Ok as long as it stays as an interactive shell
variable.
Based on a shell I used years ago that had built-in functionality similar to
CDPATH, I naïvely *assumed* CDPATH would only impact interactive shells.

In another message, Julian wrote:
I guess part of the problem is that a lot of these people don't actually 
understand the difference between shell variables and environment 
variables, or why the distinction is useful.  Plenty of people seem to do 
"export FOO=..." by rote.
Not quite my case, but assumptions are dangerous things.  Based on my 
assumption, I intentionally exported CDPATH so it would propagate when
I "xterm&".  Grr, I guess I'll have to alias xterm instead.

Thanks for the enlightenment gentlemen.

Yet another reason I like "git reset --hard HEAD" for stupid patch removal.

Now if there was a "reset --hard HEAD" function for some people I've met...

Thanks,

Ron
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help