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

Andrew Gregory andrew.gregory.8 at gmail.com
Sun Mar 20 12:22:05 UTC 2016


On 03/20/16 at 10:02pm, Allan McRae wrote:
> 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

This is actually how we originally handled emptydirs; it was changed
in 19c2347507fc0847572e30edd25809f5bc9a9ffb for compatibility with
busybox's find which does not have -empty.  -empty is also not
specified by POSIX.

>  	fi
>  }
> -- 
> 2.7.3


More information about the pacman-dev mailing list