Resolving symlinked dirs when execing command
Denys Vlasenko
vda.linux at googlemail.com
Thu Oct 11 13:53:03 UTC 2007
Hi Pavel,
On Thursday 11 October 2007 14:40, Pavel Tsekov wrote:
> > $ pwd
> > /auto/software
> >
> > It differs from what happens under e.g. shell:
> >
> > sh-3.1$ cd /software
> > sh-3.1$ pwd
> > /software
> >
> > Why mc resolves dir and cd'es into it before it forks a child?
>
> I am not able to reporoduce this behaviour. If you want me to track it
> down you'll have to give more details. I tried with latest CVS version of MC with subshell support enabled. I created a link to a random directory and entered it via "cd linkname" entered from the prompt widget, then I pressed Ctrl + O and in the subshell I ended up in "linkname" and not in the resolved directory. Also running `pwd' from the prompt widget did not print the resolved dir but "linbkname".
I was wrong. In Unix, there is no remebering of "which
symlink you followed by chdir'ing here". shell just tries
to help with that. pwd builtin will lie, but "real"
current directory cannot be a symlink:
sh-3.1$ ls -l /software
lrwxrwxrwx 1 root root 14 Jun 26 12:23 /software -> /auto/software
sh-3.1$ cd /software
sh-3.1$ pwd
/software <======= shell lied to you
sh-3.1$ /bin/pwd
/auto/software <====== truth
--
vda
More information about the mc-devel
mailing list