summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-12-06 23:32:34 -0600
committerDan McGee <dan@archlinux.org>2008-12-07 22:11:37 -0600
commit818fae320f22ea758765a55b3a3a98e2f0a66a45 (patch)
tree144fb99ea3ad5fc6b1e45402654b80360d5db254
parent69be73f68cc770ddcbe388af96e32f8bba7886f7 (diff)
makepkg: ensure PKGBUILD does not contain CRLF characters
Do a simple check before sourcing the file to ensure we are a valid bash script. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--scripts/makepkg.sh.in6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index b8896258..179746d2 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1354,6 +1354,12 @@ if [ ! -f "$BUILDSCRIPT" ]; then
# PKGBUILD passed through a pipe
BUILDSCRIPT=/dev/stdin
fi
+else
+ crlftest=$(file $BUILDSCRIPT | grep -F 'CRLF' || true)
+ if [ "$crlftest" != "" ]; then
+ error "$(gettext "%s contains CRLF characters and cannot be sourced.")" "$BUILDSCRIPT"
+ exit 1
+ fi
fi
source "$BUILDSCRIPT"