From 818fae320f22ea758765a55b3a3a98e2f0a66a45 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 6 Dec 2008 23:32:34 -0600 Subject: 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 --- scripts/makepkg.sh.in | 6 ++++++ 1 file changed, 6 insertions(+) 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" -- cgit v1.2.3-70-g09d2