Based on testing with GNU's pwd, it seems like the -P flag should
take precedence over the use of the POSIXLY_CORRECT flag.

Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>
This commit is contained in:
Tracy
2023-06-04 16:03:01 +02:00
committed by GitHub
co-authored by Terts Diepraam
parent 112f1ee8be
commit 126bbba17a
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -115,7 +115,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
// if POSIXLY_CORRECT is set, we want to a logical resolution.
// This produces a different output when doing mkdir -p a/b && ln -s a/b c && cd c && pwd
// We should get c in this case instead of a/b at the end of the path
let cwd = if matches.get_flag(OPT_LOGICAL) || env::var("POSIXLY_CORRECT").is_ok() {
let cwd = if matches.get_flag(OPT_PHYSICAL) {
physical_path()
} else if matches.get_flag(OPT_LOGICAL) || env::var("POSIXLY_CORRECT").is_ok() {
logical_path()
} else {
physical_path()
+1 -1
View File
@@ -116,7 +116,7 @@ fn test_symlinked_default_posix_p() {
.env("POSIXLY_CORRECT", "1")
.arg("-P")
.succeeds()
.stdout_is(env.symdir + "\n");
.stdout_is(env.subdir + "\n");
}
#[cfg(not(windows))]