mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +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:
parent
112f1ee8be
commit
126bbba17a
2 changed files with 4 additions and 2 deletions
|
@ -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()
|
||||||
|
|
|
@ -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))]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue