Skip to content

Commit

Permalink
ls: fix panic when file removed too quickly
Browse files Browse the repository at this point in the history
Fixes #5371
  • Loading branch information
sanpii committed Oct 7, 2023
1 parent 91c8724 commit d2ee012
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/uu/ls/src/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2888,7 +2888,11 @@ fn classify_file(path: &PathData, out: &mut BufWriter<Stdout>) -> Option<char> {
Some('=')
} else if file_type.is_fifo() {
Some('|')
} else if file_type.is_file() && file_is_executable(path.md(out).as_ref().unwrap()) {
} else if file_type.is_file()
// Safe unwraping if the file was removed between listing and display

Check failure on line 2892 in src/uu/ls/src/ls.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

ERROR: Unknown word (unwraping) (file:'src/uu/ls/src/ls.rs', line:2892)
// See https://github.com/uutils/coreutils/issues/5371
&& path.md(out).map(file_is_executable).unwrap_or_default()
{
Some('*')
} else {
None
Expand Down

0 comments on commit d2ee012

Please sign in to comment.