On Sun, Jun 29, 2014 at 9:42 AM, Pádraig Brady <[email protected]> wrote: > POSIX says that `pwd` without options should assume -L is specified. > pwd is most often invoked as a shell builtin and bash, dash, zsh, ksh > all follow POSIX and assume that -L is the default. > However coreutils pwd assumes -P is the default, according to this > comment in the source: > > "POSIX requires a default of -L, but most scripts expect -P." > > I'm not sure that is correct though, since the vast majority > of scripts would be executing the shell builtin? > > Note also that the solaris sh builtin and separate pwd util > only support -P behavior.
Hi Pádraig, When I wrote the original pwd.c, the standard was POSIX 1003.2-1992, and someone had actually sent me hard copy for Volumes 1 and 2. I've just checked (still have them) and see it says simply to print "an absolute pathname of the current working directory", so I made it call xgetcwd and print that. I think it's fine to make -L the default, now. As you say, it will make our version conform to the newer standard and eliminate a small source of incompatibility between the modern built-ins and exec'd versions of this command. Any time we make such a change, there is a risk of causing a script to malfunction, but I think very few scripts exec pwd, and fewer still would malfunction with this change. I like the idea. Jim
