On Mon, Mar 21, 2016 at 11:54:47AM +1000, Allan McRae wrote:
> Using "-exec command {} +" systax exits on any error.  Such errors occur when
> running rmdir on a non-empty directory.  Switch to "{} ;" syntax instead which
> avoids exiting before the find command is completed.
> 
> Fixes FS#48515.
> 
> Note, we can not use "-empty" in the find command because it is not supported
> by Busybox find, and the "--ignore-fail-on-non-empty" flag for rmdir is not
> available on BSD rmdir variants.
> 
> Signed-off-by: Allan McRae <[email protected]>
> ---
> 
> Comment added to avoid trying '-empty' again in the future...
> 
>  scripts/libmakepkg/tidy/emptydirs.sh.in | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/libmakepkg/tidy/emptydirs.sh.in 
> b/scripts/libmakepkg/tidy/emptydirs.sh.in
> index 32b8d8c..3be6005 100644
> --- a/scripts/libmakepkg/tidy/emptydirs.sh.in
> +++ b/scripts/libmakepkg/tidy/emptydirs.sh.in
> @@ -33,6 +33,7 @@ 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
> +             # we are unable to use '-empty' as it is non-POSIX and not 
> support by all find variants
> +             find . -depth -type d -exec rmdir '{}' ; 2>/dev/null

Shouldn't this be ';' or \; ? Otherwise, it has no meaning other than
delimiting a command and find should fail on a syntax error...

>       fi
>  }
> -- 
> 2.7.3

Reply via email to