mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07: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:
@@ -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()
|
||||
|
||||
@@ -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))]
|
||||
|
||||
Reference in New Issue
Block a user