Re: pwd default behavior

"Jin Guojun[VFF]" <[email protected]>
Newsgroups gmane.os.freebsd.questions
Message-ID <[email protected]>
On 2/6/26 10:18, Chris Hill wrote:
> On Fri, 6 Feb 2026, Jin Guojun[VFF] wrote:
>
>> On 2/6/26 08:30, Dag-Erling Sm?rgrav wrote:
>>> Simon Wollwage <[email protected]> writes:
>>>> While reading the code for /bin/pwd, I noticed that the default 
>>>> behavior
>>>> in the code is to assume -P if no arguments are supplied, but 
>>>> according
>>>> to POSIX it shoud be -L
>>>> (https://pubs.opengroup.org/onlinepubs/9799919799/utilities/pwd.html)
>>>>
>>>> Is it for convenience reasons or other technical reasons? Seems 
>>>> like an
>>>> easy change to make it compliant.
>>> It makes very little difference in practice as pwd(1) is usually a 
>>> shell
>>> built-in, but: https://reviews.freebsd.org/D55146
>>>
>>> DES
>>
>> It does make some difference because one wants to know where one 
>> really is at :-)
>>
>> Since there is another command "dirs" which does "pwd -L", so pwd 
>> defaulting to -P makes sense to provide the real location.
>
> `dirs` exists in csh. In my shell, /bin/sh, there is no `dirs` and 
> `pwd` defaults to the -L behavior.
>
The man page should be updated to reflect the different behaviors 
between sh and csh.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.