I have discovered that a leading or trailing space in bash's PATH variable has the same effect as placing a '.' in there. I'm not a Linux newbie but I just found this out by talking to some people in #gentoo. I've read a number of books on the issue and can't ever recall reading that. I suggest that a comment be added to: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=5 In section 5a, Envirnment Variables, under the PATH portion. I am also going to try and get a comment added to /etc/bash/bashrc and /etc/skel/.bashrc as well.
i dont really want to add this to bashrc but the handbook sounds good this isnt just PATH, just about all variables that represent paths and are delimited have the implied meaning NULL == $PWD so LD_LIBRARY_PATH="/blah/blah:" means search /blah/blah and $PWD
we're talking here about trailing space, not trailing delimiter. I just tried, and having "export PATH="${PATH} "" or " ${PATH}" does not imply ${PWD}. I'm marking this as WONTFIX, there is no reason to describe how all this works in the Gentoo Handbook as it's more bash general and doesn't affect anything written in the chapter.
i think he just typoed in the original comment considering his summary says leading/trailing :
I just noticed the deatils section of my original and the comments that follow and I want to apologize for saying space. I meant to say colon. I really don't remember having seen any warnings about this in my readings but the man pages does say: " A zero-length (null) directory name in the value of PATH indicates the current directory. A null directory name may appear as two adjacent colons, or as an initial or trailing colon." I'm going to reopen this so that you see this last comment but if you want to close it then I'm not going to object. *I* won't make that mistake again. There were quite a few people in #gentoo that were surprised by this behavior, including some of the ops. I don't see how a single line about it can be bad and might cause users to be more conscious of their PATH settings. I suggest: "An empty string, leading/trailing colon, or pair of colons implies the current directory."
Because people asked so nicely on irc :p
I've integrated it in an example further down the chapter. I don't think it was worth adding a new paragraph for this because the subject of the chapter is not to talk about the PATH variable or how it is treated by bash, but how Portage works with the variables. So I made a compromise and had an example add the current working directory.