瀏覽代碼

do not error if auto-detect-proxy cmd has no output

Regression introduced in 8f858d560e3b7b475c623c4e242d1edce246025a.

Commands are probably better of always having output through as the
fall through to the generic proxy settings is likely not intended. As
documenting and implementing this more consistently is kind of a
regression through, it is split off into the next commit.

Closes: 827713
David Kalnischkies 10 年之前
父節點
當前提交
cad1877559
共有 2 個文件被更改,包括 8 次插入 和 2 次删除
  1. 1 1
      apt-pkg/contrib/proxy.cc
  2. 7 1
      test/integration/test-apt-helper

+ 1 - 1
apt-pkg/contrib/proxy.cc

@@ -52,7 +52,7 @@ bool AutoDetectProxy(URI &URL)
       return _error->Error("ProxyAutoDetect command '%s' failed!", AutoDetectProxyCmd.c_str());
       return _error->Error("ProxyAutoDetect command '%s' failed!", AutoDetectProxyCmd.c_str());
    char buf[512];
    char buf[512];
    if (PipeFd.ReadLine(buf, sizeof(buf)) == nullptr)
    if (PipeFd.ReadLine(buf, sizeof(buf)) == nullptr)
-      return _error->Error("Failed to read in AutoDetectProxy");
+      return true;
    PipeFd.Close();
    PipeFd.Close();
    ExecWait(Child, "ProxyAutoDetect", true);
    ExecWait(Child, "ProxyAutoDetect", true);
    auto const cleanedbuf = _strstrip(buf);
    auto const cleanedbuf = _strstrip(buf);

+ 7 - 1
test/integration/test-apt-helper

@@ -74,7 +74,13 @@ E: Download Failed"
 test_apt_helper_detect_proxy() {
 test_apt_helper_detect_proxy() {
     # no proxy
     # no proxy
     testsuccessequal "Using proxy '' for URL 'http://example.com/'" apthelper auto-detect-proxy http://example.com/
     testsuccessequal "Using proxy '' for URL 'http://example.com/'" apthelper auto-detect-proxy http://example.com/
-
+    cat > apt-proxy-detect <<'EOF'
+#!/bin/sh -e
+exit 0
+EOF
+    chmod 755 apt-proxy-detect
+    echo "Acquire::http::Proxy-Auto-Detect \"$(pwd)/apt-proxy-detect\";" > rootdir/etc/apt/apt.conf.d/02proxy-detect
+    testsuccessequal "Using proxy '' for URL 'http://www.example.com/'" apthelper auto-detect-proxy http://www.example.com
 
 
     # http auto detect proxy script
     # http auto detect proxy script
     cat > apt-proxy-detect <<'EOF'
     cat > apt-proxy-detect <<'EOF'