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>
This commit is contained in:
parent
69be73f68c
commit
818fae320f
1 changed files with 6 additions and 0 deletions
|
@ -1354,6 +1354,12 @@ if [ ! -f "$BUILDSCRIPT" ]; then
|
||||||
# PKGBUILD passed through a pipe
|
# PKGBUILD passed through a pipe
|
||||||
BUILDSCRIPT=/dev/stdin
|
BUILDSCRIPT=/dev/stdin
|
||||||
fi
|
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
|
fi
|
||||||
|
|
||||||
source "$BUILDSCRIPT"
|
source "$BUILDSCRIPT"
|
||||||
|
|
Loading…
Add table
Reference in a new issue