Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/uu/ls/locales/en-US.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ls-error-cannot-open-directory-bad-descriptor = cannot open directory {$path}: B
ls-error-unknown-io-error = unknown io error: {$path}, '{$error}'
ls-error-invalid-block-size = invalid --block-size argument {$size}
ls-error-dired-and-zero-incompatible = --dired and --zero are incompatible
ls-error-not-directory = cannot access {$path}: Not a directory
ls-error-not-listing-already-listed = {$path}: not listing already-listed directory
ls-error-invalid-time-style = invalid --time-style argument {$style}
Possible values are:
Expand Down
1 change: 1 addition & 0 deletions src/uu/ls/src/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ enum LsError {
IOError(#[from] std::io::Error),

#[error("{}", match .1.kind() {
ErrorKind::NotADirectory => translate!("ls-error-not-directory", "path" => .0.quote()),
ErrorKind::NotFound => translate!("ls-error-cannot-access-no-such-file", "path" => .0.quote()),
ErrorKind::PermissionDenied => match .1.raw_os_error().unwrap_or(1) {
1 => translate!("ls-error-cannot-access-operation-not-permitted", "path" => .0.quote()),
Expand Down
14 changes: 14 additions & 0 deletions tests/by-util/test_ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@ const COMMA_ARGS: &[&str] = &["-m", "--format=commas", "--for=commas"];

const COLUMN_ARGS: &[&str] = &["-C", "--format=columns", "--for=columns"];

#[test]
#[cfg(unix)]
fn test_directory_in_file() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.touch("file");

scene
.ucmd()
.arg("file/missing")
.fails_with_code(2)
.stderr_is("ls: cannot access 'file/missing': Not a directory\n");
}

#[test]
fn test_invalid_flag() {
new_ucmd!()
Expand Down
Loading