[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alterna
From: |
Bob Proulx |
Subject: |
Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd |
Date: |
Tue, 2 Jan 2007 10:50:00 -0700 |
User-agent: |
Mutt/1.5.9i |
Bojan Land wrote:
> Is what I am describing a bug, or lack of understanding?
I am not sure. I read through your posting very carefully but was not
quite sure what you were asking. Could we on the mailing list have
more information?
> There are three examples here. If executable file is in cwd and path
> points to cwd and if the same file is referenced bash executes a file
> that is outside of the cwd! This to me seems quite dangerous, though I
> realize it could just be my inexperience with bash.
Did you previously reference the file and have that path cached? This
would mean that you would need to tell bash to discard the hash and to
rehash everything.
hash -r
> [user@host bin]$ which mycmd
> /bin/mycmd
The which command is a standalone program (sometimes csh, sometimes
bash, sometimes other things). It will never have a hashed path.
Better to use 'type' in this case.
type mycmd
What does bash say the type of mycmd is? I think it is previously
hashed to /bin/mycmd and that after that point in your shell that you
added the local ./mycmd. If you started up a fresh shell it would not
have been cached there.
> BASHBUG2: description or implementation of option P
Need more information.
> BUGDESC: When P is unset the symlink is still followed, though PS not
> updated.
> Reference from man:
> -P If set, the shell does not follow symbolic links when
> executing commands such as cd that change the current
> working directory. It uses the physical directory
> structure instead. By default, bash follows the logi-
> cal chain of directories when performing commands which
> change the current directory.
What is not clear about the description? Can you suggest an
improvement?
> lrwxrwxrwx 1 root root 24 Nov 4 2005 public_html ->
> /var/www/html_users/user
> [root@host user]# set -P
> [root@host user]# cd public_html
> [root@host user]# pwd
> /var/www/html_users/user
Looks good. Bash did not track the logical value of how you got there
but instead used the actual physical paths.
> [root@host user]# cd /home/user
> [root@host user]# set +P
> [root@host user]# cd public_html
> [root@host public_html]# pwd
> /home/user/public_html
Looks good. Bash remembered that it got there through the path
/home/user/public_html even though you are really someplace else
entirely. If you 'cd ..' it will back up a directory and you will be
back in your /home/user directory.
I can tell that there is still something that is not understood about
physical and logical paths but I don't know what the misunderstanding
is at this point. Need more information.
Bob
- GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd, Bojan Land, 2007/01/02
- Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd,
Bob Proulx <=
- Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd, Bojan Land, 2007/01/02
- Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd, Bob Proulx, 2007/01/04
- Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd, Matthew Woehlke, 2007/01/04
- Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd, Bob Proulx, 2007/01/04
- Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd, Matthew Woehlke, 2007/01/04
- Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd, Bojan Land, 2007/01/04
- Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd, Bob Proulx, 2007/01/04
- Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd, Bojan Land, 2007/01/05
- Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd, Matthew Woehlke, 2007/01/04
- Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd, Matthew Woehlke, 2007/01/04