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

(cherry picked from commit 2df923c5d2d02350abc29f61b603c5b9615b225c)

Details

Provenance
desAuthored on Feb 10 2026, 2:29 PM
Reviewer
olce
Differential Revision
D55146: pwd: Clean up and adopt POSIX semantics
Parents
rGe661c4c4a3a3: m4: Change defn processing order
Branches
Unknown
Tags
Unknown