Source: autopkgtest
Version: 3.9
Severity: minor
Tags: patch

Hi,

adt-setup-vm uses a $proxy variable which will not exist if no proxy is
locally configured. Because theadt-setup-vm script sets -u, this
generates an error during vmbootstrap:

    Setting up networking
    Running customize script /usr/share/autopkgtest/adt-setup-vm
    /usr/share/autopkgtest/adt-setup-vm: 86: 
/usr/share/autopkgtest/adt-setup-vm: proxy: parameter not set

Regards,
Christian

PS: This is a re-submission, as the first submission must have been
eaten by the spam filter or something (had a dollar sign in subject).
I refreshed the patch to apply after the fix in #775076.

Regards,
Christian
>From 62362d85fede808b8a79fa22477133be1c43cc83 Mon Sep 17 00:00:00 2001
From: Christian Kastner <c...@kvr.at>
Date: Sun, 11 Jan 2015 00:36:32 +0100
Subject: adt-setup-vm: Make sure $proxy variable exists before using it

On systems where apt is not configured to use a proxy, the apt-config query
will return the empty string, the eval will be a nullop, and the following
access to $proxy will print an error because the shell has -u set.
---
 tools/adt-setup-vm | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/adt-setup-vm b/tools/adt-setup-vm
index 030e785..b2f83d2 100755
--- a/tools/adt-setup-vm
+++ b/tools/adt-setup-vm
@@ -85,11 +85,13 @@ echo 'force-unsafe-io' > "$root"/etc/dpkg/dpkg.cfg.d/autopkgtest
 # auto-detect apt-cacher-ng
 if [ -z "${ADT_APT_PROXY:-}" ]; then
     RES=`apt-config shell proxy Acquire::http::Proxy`
-    eval $RES
-    if echo "$proxy" | egrep -q '(localhost|127\.0\.0\.[0-9]*):3142'; then
-        ADT_APT_PROXY="http://10.0.2.2:3142";
-        # set http_proxy for the initial apt-get update
-        export http_proxy="$proxy"
+    if [ -n "$RES" ]; then
+        eval $RES
+        if echo "$proxy" | egrep -q '(localhost|127\.0\.0\.[0-9]*):3142'; then
+            ADT_APT_PROXY="http://10.0.2.2:3142";
+            # set http_proxy for the initial apt-get update
+            export http_proxy="$proxy"
+        fi
     fi
 fi
 
-- 
2.1.4

Reply via email to