Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Feb 2026 13:18:52 -0500 (EST)
From:      Chris Hill <chris@monochrome.org>
To:        "Jin Guojun[VFF]" <jguojun@gmail.com>
Cc:        questions@freebsd.org
Subject:   Re: pwd default behavior
Message-ID:  <alpine.BSF.2.20.2602061316270.53186@tripel.monochrome.org>
In-Reply-To: <6384c7bf-e66f-4baf-8b23-0e3b16e1a7f9@gmail.com>
References:  <877bsqe6m0.fsf@x1.laptops.machines> <86ms1lbzsd.fsf@ltc.des.dev> <6384c7bf-e66f-4baf-8b23-0e3b16e1a7f9@gmail.com>

index | next in thread | previous in thread | raw e-mail

On Fri, 6 Feb 2026, Jin Guojun[VFF] wrote:

> On 2/6/26 08:30, Dag-Erling Sm?rgrav wrote:
>> Simon Wollwage <rootnode+freebsd@wollwage.com> 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.

-- 
Chris Hill               chris@monochrome.org


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.20.2602061316270.53186>