summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-12-13 05:27:09 +0000
committerZac Medico <zmedico@gentoo.org>2007-12-13 05:27:09 +0000
commit8073c5d103ca766d8115c026746ce8fcb898f5e9 (patch)
tree2c4671f148ec3e9b5a8a60be6752392c03a6254f
parent4f48b4a676e7963ba26dd949d420fb8c9daa46d6 (diff)
downloadportage-8073c5d103ca766d8115c026746ce8fcb898f5e9.tar.gz
portage-8073c5d103ca766d8115c026746ce8fcb898f5e9.tar.bz2
portage-8073c5d103ca766d8115c026746ce8fcb898f5e9.zip
Bug #201771 - Make unpack() detect common errors such as absolute
paths that start with ${DISTDIR} and die an appropriate error message. Thanks to grobian for this patch. svn path=/main/trunk/; revision=8896
-rwxr-xr-xbin/ebuild.sh11
1 files changed, 6 insertions, 5 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 50222eb6e..ff0dd78c4 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -313,15 +313,16 @@ unpack() {
y=${x%.*}
y=${y##*.}
- myfail="${x} does not exist"
- if [ "${x:0:2}" = "./" ] ; then
+ if [[ ${x} == "./"* ]] ; then
srcdir=""
+ elif [[ ${x} == ${DISTDIR%/}/* ]] ; then
+ die "Arguments to unpack() cannot begin with \${DISTDIR}."
+ elif [[ ${x} == "/"* ]] ; then
+ die "Arguments to unpack() cannot be absolute"
else
srcdir="${DISTDIR}/"
fi
- [[ ${x} == ${DISTDIR}* ]] && \
- die "Arguments to unpack() should not begin with \${DISTDIR}."
- [ ! -s "${srcdir}${x}" ] && die "$myfail"
+ [[ ! -s ${srcdir}${x} ]] && die "${x} does not exist"
myfail="failure unpacking ${x}"
case "${x##*.}" in