[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash bug

From: Bob Proulx
Subject: Re: bash bug
Date: Sun, 10 Jun 2001 21:07:13 -0600

> Under Linux 7.0 with bash 2.04.11:

1. You should report this to address@hidden and not
   address@hidden  Wrong list.  But an honest mistake.  And of
   course we have the best support over here.  :-)

2. What you are seeing is considered a feature by many.  As an old
   timer I don't like it since it causes confusion.  But 99% of
   everyone I talk with about this prefers the new behavior which
   creates a facade around symlinks.  We are out voted.  This was
   originally introduced in ksh, the Korn shell, and bash has followed
   suit ksh in this matter.

  info bash

          cd [-LP] [DIRECTORY]
     Change the current working directory to DIRECTORY.  If DIRECTORY
     is not given, the value of the `HOME' shell variable is used.  If
     the shell variable `CDPATH' exists, it is used as a search path.
     If DIRECTORY begins with a slash, `CDPATH' is not used.  The `-P'
     option means to not follow symbolic links; symbolic links are
     followed by default or with the `-L' option.  If DIRECTORY is `-',
     it is equivalent to `$OLDPWD'.  The return status is zero if the
     directory is successfully changed, non-zero otherwise.

          pwd [-LP]
     Print the current working directory.  If the `-P' option is
     supplied, the path printed will not contain symbolic links.  If
     the `-L' option is supplied, the path printed may contain symbolic
     links.  The return status is zero unless an error is encountered
     while determining the name of the current directory or an invalid
     option is supplied.

   * The Bash `cd' and `pwd' builtins (*note Bourne Shell Builtins::.)
     each take `-L' and `-P' builtins to switch between logical and
     physical modes.

          set [--abefhkmnptuvxBCHP] [-o OPTION] [ARGUMENT ...]
    `-o OPTION-NAME'
               Same as `-P'.
          If set, do not follow symbolic links when performing commands
          such as `cd' which change the current directory.  The
          physical directory is used instead.  By default, Bash follows
          the logical chain of directories when performing commands
          which change the current directory.

          For example, if `/usr/sys' is a symbolic link to
          `/usr/local/sys' then:
               $ cd /usr/sys; echo $PWD
               $ cd ..; pwd

          If `set -P' is on, then:
               $ cd /usr/sys; echo $PWD
               $ cd ..; pwd

Try setting either 'set -o physical' or equivalently 'set -P' in your
$HOME/.bashrc file and you will always follow the physical path.

Hope that helps

> If I'm in /etc/init.d dir, and want to edit /etc/dhcpd.conf, I go
> vi ../dhcpd.conf
> However, this doesn't work.
> It seems that if you cd into a link to a directory, when you attempt to use 
> "up one directory" it
> follows the "real" path, insted of the "linked" path.
> When you do a pwd, it reports the "linked" path, not the "real" path.
> EG:
> /etc/init.d is a link to /etc/rc.d/init.d.
> Here are some screen clips:
> ---8<cut here>8---
> address@hidden /root]# cd /etc/init.d
> address@hidden init.d]# pwd
> /etc/init.d
> address@hidden init.d]# cd ..
> address@hidden /etc]# ls -ld init.d
> lrwxrwxrwx    1 root     root           11 May 30 17:18 init.d -> rc.d/init.d
> address@hidden /etc]#
> ---8<cut here>8---
> Hope I gave you what you need to see the problem, or tell me to soak my 
> head for being stupid!
> Have a good one.
> _______________________________________________
> Bug-sh-utils mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-sh-utils

reply via email to

[Prev in Thread] Current Thread [Next in Thread]