Hello community,

here is the log from the commit of package dub for openSUSE:Factory checked in 
at 2018-01-26 13:40:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/dub (Old)
 and      /work/SRC/openSUSE:Factory/.dub.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "dub"

Fri Jan 26 13:40:24 2018 rev:4 rq:569751 version:1.7.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/dub/dub.changes  2018-01-20 11:26:39.928504456 
+0100
+++ /work/SRC/openSUSE:Factory/.dub.new/dub.changes     2018-01-26 
13:40:27.334615732 +0100
@@ -1,0 +2,7 @@
+Wed Jan 24 21:51:23 UTC 2018 - [email protected]
+
+- Update to version 1.7.1
+  * Timeout requests to query mirror instead of hanging - pull 
(gh#dlang/dub#1338)
+- Change to %autosetup rpm macro
+
+-------------------------------------------------------------------

Old:
----
  dub-1.7.0.tar.gz

New:
----
  dub-1.7.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ dub.spec ++++++
--- /var/tmp/diff_new_pack.p6fiMB/_old  2018-01-26 13:40:28.454563428 +0100
+++ /var/tmp/diff_new_pack.p6fiMB/_new  2018-01-26 13:40:28.458563241 +0100
@@ -17,12 +17,12 @@
 
 
 Name:           dub
-Version:        1.7.0
+Version:        1.7.1
 Release:        0
 Summary:        Package manager and meta build tool for the D programming 
language
 License:        MIT
 Group:          Development/Languages/Other
-URL:            http://code.dlang.org
+Url:            http://code.dlang.org
 Source:         
https://github.com/dlang/dub/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
 BuildRequires:  dmd
 BuildRequires:  git
@@ -39,7 +39,7 @@
 (dub's package description) as project file.
 
 %prep
-%setup -q
+%autosetup
 
 # reproducible builds:
 perl -i -pe 's{__DATE__}{""}g' source/dub/commandline.d

++++++ dub-1.7.0.tar.gz -> dub-1.7.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dub-1.7.0/CHANGELOG.md new/dub-1.7.1/CHANGELOG.md
--- old/dub-1.7.0/CHANGELOG.md  2018-01-02 21:51:29.000000000 +0100
+++ new/dub-1.7.1/CHANGELOG.md  2018-01-21 23:30:48.000000000 +0100
@@ -1,6 +1,13 @@
 Changelog
 =========
 
+v1.7.1 - 2018-01-
+-------------------
+
+- Timeout requests to query mirror instead of hanging - [pull #1338][issue1338]
+
+[issue1338]: https://github.com/dlang/dub/issues/1338
+
 v1.7.0 - 2018-01-01
 -------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dub-1.7.0/source/dub/internal/utils.d 
new/dub-1.7.1/source/dub/internal/utils.d
--- old/dub-1.7.0/source/dub/internal/utils.d   2018-01-02 21:51:29.000000000 
+0100
+++ new/dub-1.7.1/source/dub/internal/utils.d   2018-01-21 23:30:48.000000000 
+0100
@@ -239,12 +239,19 @@
 
        Any redirects will be followed until the actual file resource is 
reached or if the redirection
        limit of 10 is reached. Note that only HTTP(S) is currently supported.
+
+       The download times out if a connection cannot be established within
+       `timeout` ms, or if the average transfer rate drops below 10 bytes / s 
for
+       more than `timeout` seconds.  Pass `0` as `timeout` to disable both 
timeout
+       mechanisms.
+
+       Note: Timeouts are only implemented when curl is used (DubUseCurl).
 */
-void download(string url, string filename)
+void download(string url, string filename, uint timeout = 8)
 {
        version(DubUseCurl) {
                auto conn = HTTP();
-               setupHTTPClient(conn);
+               setupHTTPClient(conn, timeout);
                logDebug("Storing %s...", url);
                static if (__VERSION__ <= 2075)
                {
@@ -265,16 +272,16 @@
        } else assert(false);
 }
 /// ditto
-void download(URL url, NativePath filename)
+void download(URL url, NativePath filename, uint timeout = 8)
 {
-       download(url.toString(), filename.toNativeString());
+       download(url.toString(), filename.toNativeString(), timeout);
 }
 /// ditto
-ubyte[] download(string url)
+ubyte[] download(string url, uint timeout = 8)
 {
        version(DubUseCurl) {
                auto conn = HTTP();
-               setupHTTPClient(conn);
+               setupHTTPClient(conn, timeout);
                logDebug("Getting %s...", url);
                static if (__VERSION__ <= 2075)
                {
@@ -298,9 +305,9 @@
        } else assert(false);
 }
 /// ditto
-ubyte[] download(URL url)
+ubyte[] download(URL url, uint timeout = 8)
 {
-       return download(url.toString());
+       return download(url.toString(), timeout);
 }
 
 /// Returns the current DUB version in semantic version format
@@ -321,7 +328,7 @@
 }
 
 version(DubUseCurl) {
-       void setupHTTPClient(ref HTTP conn)
+       void setupHTTPClient(ref HTTP conn, uint timeout)
        {
                static if( is(typeof(&conn.verifyPeer)) )
                        conn.verifyPeer = false;
@@ -333,6 +340,13 @@
                if (noProxy.length) conn.handle.set(CurlOption.noproxy, 
noProxy);
 
                conn.handle.set(CurlOption.encoding, "");
+               if (timeout) {
+                       // connection (TLS+TCP) times out after 8s
+                       conn.handle.set(CurlOption.connecttimeout, timeout);
+                       // transfers time out after 8s below 10 byte/s
+                       conn.handle.set(CurlOption.low_speed_limit, 10);
+                       conn.handle.set(CurlOption.low_speed_time, 5);
+               }
 
                conn.addRequestHeader("User-Agent", "dub/"~getDUBVersion()~" 
(std.net.curl; +https://github.com/rejectedsoftware/dub)");
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dub-1.7.0/source/dub/version_.d 
new/dub-1.7.1/source/dub/version_.d
--- old/dub-1.7.0/source/dub/version_.d 2018-01-02 21:51:29.000000000 +0100
+++ new/dub-1.7.1/source/dub/version_.d 2018-01-21 23:30:48.000000000 +0100
@@ -1,2 +1,2 @@
 module dub.version_;
-enum dubVersion = "v1.7.0";
+enum dubVersion = "v1.7.1";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dub-1.7.0/test/run-unittest.sh 
new/dub-1.7.1/test/run-unittest.sh
--- old/dub-1.7.0/test/run-unittest.sh  2018-01-02 21:51:29.000000000 +0100
+++ new/dub-1.7.1/test/run-unittest.sh  2018-01-21 23:30:48.000000000 +0100
@@ -3,11 +3,11 @@
 . $(dirname "${BASH_SOURCE[0]}")/common.sh
 
 function log() {
-    echo -e "\033[0;33m[INFO] "$@"\033[0m"
+    echo -e "\033[0;33m[INFO] $@\033[0m"
 }
 
 function logError() {
-    echo -e 1>&2 "\033[0;31m[ERROR] "$@"\033[0m"
+    echo -e 1>&2 "\033[0;31m[ERROR] $@\033[0m"
     any_errors=1
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dub-1.7.0/test/timeout.sh 
new/dub-1.7.1/test/timeout.sh
--- old/dub-1.7.0/test/timeout.sh       1970-01-01 01:00:00.000000000 +0100
+++ new/dub-1.7.1/test/timeout.sh       2018-01-21 23:30:48.000000000 +0100
@@ -0,0 +1,43 @@
+#!/usr/bin/env bash
+
+. $(dirname "${BASH_SOURCE[0]}")/common.sh
+
+PORT=$(($$ + 1024)) # PID + 1024
+
+log '    Testing unconnectable registry'
+if timeout 1s $DUB fetch dub --skip-registry=all 
--registry=http://localhost:$PORT; then
+    die 'Fetching from unconnectable registry should fail.'
+elif [ $? -eq 124 ]; then
+    die 'Fetching from unconnectable registry should fail immediately.'
+fi
+
+log '    Testing non-responding registry'
+cat | nc --listen $PORT >/dev/null &
+PID=$!
+if timeout 10s $DUB fetch dub --skip-registry=all 
--registry=http://localhost:$PORT; then
+    die 'Fetching from non-responding registry should fail.'
+elif [ $? -eq 124 ]; then
+    die 'Fetching from non-responding registry should time-out within 8s.'
+fi
+kill $PID 2>/dev/null || true
+
+log '    Testing too slow registry'
+{
+    res=$(printf 'HTTP/1.1 200 OK\r
+Server: dummy\r
+Content-Type: application/json\r
+Content-Length: 2\r
+\r
+{}')
+    for i in $(seq 0 $((${#res} - 1))); do
+        echo -n "${res:$i:1}"
+        sleep 1
+    done
+} | nc --listen $PORT >/dev/null &
+PID=$!
+if timeout 10s time $DUB fetch dub --skip-registry=all 
--registry=http://localhost:$PORT; then
+    die 'Fetching from too slow registry should fail.'
+elif [ $? -eq 124 ]; then
+    die 'Fetching from too slow registry should time-out within 8s.'
+fi
+kill $PID 2>/dev/null || true


Reply via email to