Skip to content

Commit

Permalink
fix issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvestre committed Dec 30, 2023
1 parent 68c99f1 commit e608ffa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/uu/rm/src/rm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,14 @@ fn remove_dir_all_recursive_continue(path: &Path) -> Result<(), bool> {
let mut had_err = false;

for child in fs::read_dir(path).map_err(|e| {
show_error!("cannot remove {}: {}", path.quote(), format_io_error(&e));
true
if e.kind() == std::io::ErrorKind::PermissionDenied {
// we will be able to manage it later with remove_dir
// so, no need to show an error
false
} else {
show_error!("cannot remove {}: {}", path.quote(), format_io_error(&e));
true
}
})? {
match child {
Ok(child) => {
Expand Down
1 change: 1 addition & 0 deletions util/build-gnu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ sed -i -e "s|rm: cannot remove 'a/b'|rm: cannot remove 'a'|g" tests/rm/fail-2epe
sed -i -e "s|rm: cannot remove 'a/1'|rm: cannot remove 'a'|g" tests/rm/rm2.sh

sed -i -e "s|removed directory 'a/'|removed directory 'a'|g" tests/rm/v-slash.sh
sed -i "s|\$prog: cannot remove '\$d': Permission denied\\\n||" tests/rm/unreadable.pl

# our error messages are better
if ! grep -q "rm: cannot remove 'b'" tests/rm/rm1.sh; then
Expand Down

0 comments on commit e608ffa

Please sign in to comment.