[PATCH modular 4/7] build.sh: recover SRCDIR when tar command fails

Gaetan Nadon memsize at videotron.ca
Fri Oct 18 15:44:57 CEST 2013


The SRCDIR is changed before running the tar command. If it fails,
the calling function attempts to cd to the directory the tar command
was not successful in creating.

Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
 build.sh |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/build.sh b/build.sh
index 6c6deb0..538aeba 100755
--- a/build.sh
+++ b/build.sh
@@ -254,6 +254,7 @@ checkfortars() {
         for jj in bz2 gz xz; do
             TARFILE=`ls -1rt $ii${component:+/}$component-*.tar.$jj 2> /dev/null | tail -n 1`
             if [ X"$TARFILE" != X ]; then
+		old_srcdir=$SRCDIR
                 SRCDIR=`echo $TARFILE | sed "s,.tar.$jj,,"`
                 SRCDIR=`echo $SRCDIR | sed "s,MesaLib,Mesa,"`
                 if [ ! -d $SRCDIR ]; then
@@ -270,6 +271,7 @@ checkfortars() {
 		    esac
                     tar $TAROPTS $TARFILE -C $ii
 		    if [ $? -ne 0 ]; then
+			SRCDIR=${old_srcdir}
 			failed tar $module $component
 			return 1
 		    fi
-- 
1.7.9.5



More information about the xorg-devel mailing list