diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-12-13 06:33:16 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-12-13 06:33:16 +0000 |
commit | 1031a01fc897540d31bd3a27eadcb4e92196d9d3 (patch) | |
tree | feb00973d89ae8c8fe73450c9e7557a46b6de0e3 | |
parent | cedad8d6c28b28ca3da940db8a66e150a9f939e3 (diff) | |
download | portage-1031a01fc897540d31bd3a27eadcb4e92196d9d3.tar.gz portage-1031a01fc897540d31bd3a27eadcb4e92196d9d3.tar.bz2 portage-1031a01fc897540d31bd3a27eadcb4e92196d9d3.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. (trunk r8896)
svn path=/main/branches/2.1.2/; revision=8903
-rwxr-xr-x | bin/ebuild.sh | 11 |
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 |