HomeFreeBSD

pwd: Clean up and adopt POSIX semantics

Description

pwd: Clean up and adopt POSIX semantics

According to POSIX, the default should be -L. Based on code history,
whoever first wrote BSD pwd(1) could not figure out how to implement
-L and therefore made -P the default (and only) option. Support for -L
was later added, but the default was never changed.

Clean up the code, make -L the default, and rewrite getcwd_logical() to
reject paths that contain dot or dot-dot, as required by POSIX.

MFC after: 1 week
Reviewed by: olce
Differential Revision: https://reviews.freebsd.org/D55146

Details

Provenance
desAuthored on Feb 10 2026, 2:29 PM
Reviewer
olce
Differential Revision
D55146: pwd: Clean up and adopt POSIX semantics
Parents
rG47fb51847fde: ipfilter: Interface name must not extend beyond end of buffer
Branches
Unknown
Tags
Unknown