1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 03:57:44 +00:00
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 10:03:01 -04:00 committed by GitHub
parent 112f1ee8be
commit 126bbba17a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

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. // 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 // 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 // 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() logical_path()
} else { } else {
physical_path() physical_path()

View file

@ -116,7 +116,7 @@ fn test_symlinked_default_posix_p() {
.env("POSIXLY_CORRECT", "1") .env("POSIXLY_CORRECT", "1")
.arg("-P") .arg("-P")
.succeeds() .succeeds()
.stdout_is(env.symdir + "\n"); .stdout_is(env.subdir + "\n");
} }
#[cfg(not(windows))] #[cfg(not(windows))]