mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 23:02:38 +00:00
ls: ignore value of POSIXLY_CORRECT
This commit is contained in:
parent
c77d389f5b
commit
51fc2d7564
2 changed files with 30 additions and 7 deletions
|
@ -20,7 +20,7 @@ use std::os::windows::fs::MetadataExt;
|
|||
use std::{
|
||||
cmp::Reverse,
|
||||
error::Error,
|
||||
ffi::{OsStr, OsString},
|
||||
ffi::OsString,
|
||||
fmt::{Display, Write as FmtWrite},
|
||||
fs::{self, DirEntry, FileType, Metadata, ReadDir},
|
||||
io::{stdout, BufWriter, ErrorKind, Stdout, Write},
|
||||
|
@ -792,14 +792,10 @@ impl Config {
|
|||
None
|
||||
}
|
||||
}
|
||||
} else if let Some(pc) = env_var_posixly_correct {
|
||||
if pc.as_os_str() == OsStr::new("true") || pc == OsStr::new("1") {
|
||||
} else if env_var_posixly_correct.is_some() {
|
||||
Some(POSIXLY_CORRECT_BLOCK_SIZE)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let long = {
|
||||
|
|
|
@ -3828,3 +3828,30 @@ fn test_ls_cf_output_should_be_delimited_by_tab() {
|
|||
.succeeds()
|
||||
.stdout_is("a2345/\tb/\n");
|
||||
}
|
||||
|
||||
#[cfg(all(unix, feature = "dd"))]
|
||||
#[test]
|
||||
fn test_posixly_correct() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
|
||||
scene
|
||||
.ccmd("dd")
|
||||
.arg("if=/dev/zero")
|
||||
.arg("of=file")
|
||||
.arg("bs=1024")
|
||||
.arg("count=1")
|
||||
.succeeds();
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("-s")
|
||||
.succeeds()
|
||||
.stdout_contains_line("total 4");
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("-s")
|
||||
.env("POSIXLY_CORRECT", "some_value")
|
||||
.succeeds()
|
||||
.stdout_contains_line("total 8");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue