[PATCH RFC] Fix "/usr/bin/xargs: rm: Argument list too long" duringmake distclean

From: David Cullen
Date: Mon Aug 13 2012 - 15:38:57 EST


When running "make distclean" in a cross chroot environment, the
following messages are emitted:

[user@host:/home/work/linux]: make distclean
/usr/bin/xargs: rm: Argument list too long
make: *** [clean] Error 126

I use the following patch to get around the problem:

diff --git a/Makefile b/Makefile
index b771af5..e2bca8e 100644
--- a/Makefile
+++ b/Makefile
@@ -1033,7 +1033,7 @@ distclean: mrproper
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-o -name '.*.rej' \
-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
- -type f -print | xargs rm -f
+ -type f -print | xargs -s 122880 rm -f


# Packaging of the kernel to various formats
@@ -1242,7 +1242,7 @@ clean: $(clean-dirs)
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
-o -name '*.symtypes' -o -name 'modules.order' \
-o -name modules.builtin -o -name '.tmp_*.o.*' \
- -o -name '*.gcno' \) -type f -print | xargs rm -f
+ -o -name '*.gcno' \) -type f -print | xargs -s 122880 rm -f

# Generate tags for editors
# ---------------------------------------------------------------------------


Is there another way to solve this problem that does not require
a patch to the Makefile?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/