uutils/coreutils

mv: error message "Directory not empty" is confusing

Closed

#5,102 opened on Jul 20, 2023

 (16 comments) (0 reactions) (0 assignees)Rust (1,981 forks)batch import
U - mvgood first issue

Repository metrics

Stars
 (23,893 stars)
PR merge metrics
 (Avg merge 5d 23h) (239 merged PRs in 30d)

Description

in file coreutils/src/uu/mv/src/mv.rs:488 when you try to move a directory to a location already containing a directory with the same name it would just write "Directory not empty" first, this is technically a wrong error message because there is no requirement that the destination would be empty. the destination might as well be populated with some content, we just require that it would not contain a directory with the same name. also, the error message is confusing because it doesn't state that the problem is with the destination. One can think that the problem is actually with the source, and that the source directory having some kind of attribute that would require it to be empty prior to moving. I would suggest to change the error message to: "a directory with the same name already exists at destination"

Contributor guide