Follow-up Comment #7, bug #57914 (project make):

Thank you all for your explanations. I think I now understand it correctly :)


[comment #6 comment #6:]
> Just as another proof that it's a feature of the shell: if you don't use the
shell's built-in pwd command but instead use /bin/pwd, you'll see that just
like make (also not a built-in command in the shell :-)) it shows the physical
path:

This one I know (already met in practice).

According to the documentation, it is just a matter of defaults: "pwd" w/o
args defaults to "pwd -L", but "/bin/pwd" to "/bin/pwd -P", but that are just
defaults:


sdettmer@RefVm3:/tmp $ cd /tmp/
sdettmer@RefVm3:/tmp $ mkdir /tmp/x1
sdettmer@RefVm3:/tmp $ ln -s /tmp/x1 foo
sdettmer@RefVm3:/tmp $ (cd foo && pwd -L && pwd && pwd -P)
/tmp/foo
/tmp/foo
/tmp/x1
sdettmer@RefVm3:/tmp $ (cd foo && /bin/pwd -L && /bin/pwd && /bin/pwd -P)
/tmp/foo
/tmp/x1
/tmp/x1
sdettmer@RefVm3:/tmp $ 


At least my /bin/pwd (GNU coreutils 8.26) is using $PWD from environment:


sdettmer@RefVm3:/tmp $ man pwd|grep -1 -- -L

       -L, --logical
              use PWD from environment, even if it contains symlinks

sdettmer@RefVm3:/tmp $ (cd foo && /bin/pwd -L && PWD="" /bin/pwd -L )
/tmp/foo
/tmp/x1


I guess the different defaults are needed for complex compatibility issues.




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57914>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply via email to