[pacman-dev] [PATCH] libmakepkg: simplify removal of empty directories

Allan McRae allan at archlinux.org
Sun Mar 20 12:02:25 UTC 2016


The find command to remove empty directories can sometimes fail with newer
versions of findutils (FS#48515). This can be replaced by a more simple
command using the -empty and -delete flags.

Signed-off-by: Allan McRae <allan at archlinux.org>
---

For pacman-5.0.2

 scripts/libmakepkg/tidy/emptydirs.sh.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/libmakepkg/tidy/emptydirs.sh.in b/scripts/libmakepkg/tidy/emptydirs.sh.in
index 32b8d8c..8afc9cc 100644
--- a/scripts/libmakepkg/tidy/emptydirs.sh.in
+++ b/scripts/libmakepkg/tidy/emptydirs.sh.in
@@ -33,6 +33,6 @@ tidy_remove+=('tidy_emptydirs')
 tidy_emptydirs() {
 	if check_option "emptydirs" "n"; then
 		msg2 "$(gettext "Removing empty directories...")"
-		find . -depth -type d -exec rmdir '{}' + 2>/dev/null
+		find . -type d -empty -delete
 	fi
 }
-- 
2.7.3


More information about the pacman-dev mailing list