The man pwd on FreeBSD - https://man.freebsd.org/pwd - states: > If no options are specified, the -P option is assumed. ... which is a lie, the -L is assumed - same as with POSIX link below: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/pwd.html Solution/Diff/Patch: - If no options are specified, the -P option is assumed. + If no options are specified, the -L option is assumed. Regards, vermaden
The code suggests otherwise: physical = 1; while ((ch = getopt(argc, argv, "LP")) != -1) switch (ch) { case 'L': physical = 0; break; case 'P': physical = 1; break; It also appears to work as documented: > mkdir foo > ln -s foo bar > cd bar > /bin/pwd /home/mark/foo > /bin/pwd -L /home/mark/bar > I suspect the problem is that the shell may provide its own pwd builtin which does indeed behave differently.
(In reply to Mark Johnston from comment #1) So shell builtin (ZSH) behaves correctly with POSIX standards. IMHO FreeBSD should also be correct with POSIX standards so option -L should be assumed in FreeBSD's pwd. I am not gonna 'fight' for this - you will do what you want - but that is my opinion. Regards, vermaden
(In reply to vermaden from comment #2) It's mostly a question of whether changing the default will break existing scripts. sh, bash and zsh use a builtin implementation for pwd, but tcsh in the base system does not, so I expect that such a change would cause a fair amount of pain. We should update the pwd(1) man page to note that we are not compliant with the standard.