From nobody Fri Feb 6 18:18:52 2026 X-Original-To: questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4f72R664bjz6FPrt for ; Fri, 06 Feb 2026 18:18:58 +0000 (UTC) (envelope-from chris@monochrome.org) Received: from mail.monochrome.org (static-71-163-255-121.washdc.fios.verizon.net [71.163.255.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail", Issuer "mail" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4f72R649f3z3Cd9 for ; Fri, 06 Feb 2026 18:18:58 +0000 (UTC) (envelope-from chris@monochrome.org) Authentication-Results: mx1.freebsd.org; none Received: from tripel.monochrome.org (tripel.monochrome.org [192.168.1.11]) by mail.monochrome.org (8.15.2/8.15.2) with ESMTP id 616IIqNL081094; Fri, 6 Feb 2026 13:18:52 -0500 (EST) (envelope-from chris@monochrome.org) Date: Fri, 6 Feb 2026 13:18:52 -0500 (EST) From: Chris Hill To: "Jin Guojun[VFF]" cc: questions@freebsd.org Subject: Re: pwd default behavior In-Reply-To: <6384c7bf-e66f-4baf-8b23-0e3b16e1a7f9@gmail.com> Message-ID: References: <877bsqe6m0.fsf@x1.laptops.machines> <86ms1lbzsd.fsf@ltc.des.dev> <6384c7bf-e66f-4baf-8b23-0e3b16e1a7f9@gmail.com> User-Agent: Alpine 2.20 (BSF 67 2015-01-07) List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-questions@freebsd.org Sender: owner-freebsd-questions@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:701, ipnet:71.163.0.0/16, country:US] X-Rspamd-Queue-Id: 4f72R649f3z3Cd9 X-Spamd-Bar: ---- On Fri, 6 Feb 2026, Jin Guojun[VFF] wrote: > On 2/6/26 08:30, Dag-Erling Sm?rgrav wrote: >> Simon Wollwage 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