cd and --bind mounts for the home directory

Dan Nicolaescu dann at ics.uci.edu
Wed Mar 28 21:01:15 EEST 2007


christos at zoulas.com (Christos Zoulas) writes:

  > On Mar 28,  8:52am, dann at ics.uci.edu (Dan Nicolaescu) wrote:
  > -- Subject: Re: cd and --bind mounts for the home directory
  > 
  > | christos at zoulas.com (Christos Zoulas) writes:
  > | 
  > |   > On Mar 26,  7:58pm, dann at ics.uci.edu (Dan Nicolaescu) wrote:
  > |   > -- Subject: cd and --bind mounts for the home directory
  > |   > 
  > |   > | 
  > |   > | 
  > |   > | On my Linux laptop use 2 different users when connected to the
  > |   > | network, with the home directory mounted via NFS and when
  > |   > | disconnected.
  > |   > | 
  > |   > | So I have a user: me with $HOME = /home/me 
  > |   > | and a user local_user with $HOME = /home2/local_user
  > |   > | 
  > |   > | To minimize differences I would like to have /home/me to point to
  > |   > | /home2/local_user when disconnected. A symlink does not work in all
  > |   > | cases, doing a "mount --bind" would be the best solution. 
  > |   > | 
  > |   > | All is well, except for the tcsh "cd" builtin that behaves strangely. 
  > |   > | So if I do: 
  > |   > | 
  > |   > | mount --bind /home2/local_user /home/me
  > |   > | cd /home/me
  > |   > | But now doing:
  > |   > | pwd
  > |   > | prints: /home2/local_user
  > |   > | 
  > |   > | The same thing works just fine for "mount --bind" any other directory
  > |   > | except for the home directory. 
  > |   > | I have tried this with tcsh-6.14.00 and 6.15.00.
  > |   > | 
  > |   > | bash, ksh and zsh behave as expected. 
  > |   > | 
  > |   > | Any idea what is wrong here? 
  > |   > 
  > |   > Nothing is wrong here; tcsh does not have a built-in pwd. if you want one
  > |   > alias pwd 'echo $cwd'
  > | 
  > | I have that already. 
  > | Please look at this sequence of commands:
  > | 
  > | $ mount --bind /home2/local_user /home/me
  > | 
  > | $ cd /home/me
  > | $ echo $cwd
  > | /home2/local_user
  > | ^^^^^^^^^^^^^^^^
  > | 
  > | And now the same thing with bash:
  > | 
  > | $ bash
  > | $ cd /home/me
  > | $ echo $PWD
  > | /home/me
  > | ^^^^^^^^^
  > 
  > Something must be wrong with your setup:
  > 
  > [12:54pm] 981#mount -o bind /usr /tmp/tmp

As I said in my first message, this case works fine for me too. Can
you please try mounting the home directory?

  > [12:54pm] 982#cd /tmp/tmp
  > [12:54pm] 983#echo $cwd
  > /tmp/tmp
  > 
  > run 'tcsh -f' and then repeat the same commands you run with bash.

Same results with "tcsh -f"



More information about the Tcsh-Bugs mailing list