[pacman-dev] [PATCH] makepkg: Only check regular files in $srcdir check

Thomas Bächler thomas at archlinux.org
Mon Jun 28 07:31:59 EDT 2010

The 'grep -R' in the $srcdir check would not only grep regular files,
but also devices, symlinks (that might potentially point outside of
$pkgdir), pipes and so on. Use find to ensure only regular files are

This should fix https://bugs.archlinux.org/task/19975

I haven't tested this yet (no time right now), but this
should work and fix the bug. Please review and comment,
I may be able to test it later.

 scripts/makepkg.sh.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index cbc344d..97bf5da 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -967,7 +967,7 @@ check_package() {
 	# check for references to the build directory
-	if grep -R "${srcdir}" "${pkgdir}" &>/dev/null; then
+	if find "${pkgdir}" -type f -exec grep -q "${srcdir}" {} +; then
 		warning "$(gettext "Package contains reference to %s")" "\$srcdir"

More information about the pacman-dev mailing list