On Tue, Jul 1, 2014 at 12:02 PM, Bob Proulx <b...@proulx.com> wrote: > Jim Meyering wrote: >> Pádraig Brady wrote: >> > POSIX says that `pwd` without options should assume -L is specified. > > Hmm... It does? If so I think that is a bad thing in the standard > since it does not standardize existing behavior but requires an > incompatible change to it. Existing behavior of /bin/pwd has always > been to print the canonical path. > >> > 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 still think that is true. I think most usage of /bin/pwd expects it > to be -P not -L. This is separate from the usage of the shell builtin. > >> 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 disagree. I think most people expect that /bin/pwd produces the > canonical path. I think changing it to print $PWD as the shell > builtin does is a bad idea since it will go against long standing > usage. I think if users were polled it would show that most people > have the built in pwd defaulting to -L and therefore explicitly > execute /bin/pwd in order to escape that logical illusion and to > return the canonical path. > > I think this very small thing is actually a huge change in legacy > behavior. Please don't do it.
Hi Bob, In coreutils tests, we had more uses than expected of $(env pwd) or equivalent that expected the -P behavior. Do you know of other uses of /bin/pwd that require -P's behavior?