<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>


<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">

<p class="details" style="font-style: italic; color: #666;">
<a href="https://gitlab.com/ametzler">Andreas Metzler</a> created an issue: <a href="https://gitlab.com/gnutls/gnutls/-/issues/1315">#1315</a>
</p>
<div></div>
<p dir="auto">Hello,</p>
<p dir="auto">I have just managed to trigger an endless loop in the testsuite:</p>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre class="code highlight js-syntax-highlight language-plaintext" lang="plaintext" v-pre="true" style="border-radius: 2px; margin: 0 0 8px; padding: 8px 12px; border: 1px solid #dbdbdb;"><code><span id="LC1" class="line" lang="plaintext">Checking with non-approved DH params: rfc5054-3072</span>
<span id="LC2" class="line" lang="plaintext">unreserved port 50626</span>
<span id="LC3" class="line" lang="plaintext">unreserved port 50626</span>
<span id="LC4" class="line" lang="plaintext">unreserved port 50626</span>
<span id="LC5" class="line" lang="plaintext">[...]</span></code></pre>
<copy-code></copy-code>
</div>
<p dir="auto">Looking at (tests/scripts/common.sh#L87) there seems to be a logic error:</p>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre class="code highlight js-syntax-highlight language-shell" lang="shell" v-pre="true" style="border-radius: 2px; margin: 0 0 8px; padding: 8px 12px; border: 1px solid #dbdbdb;"><code><span id="LC1" class="line" lang="shell"><span class="nv">GETPORT</span><span class="o">=</span><span class="s1">'</span></span>
<span id="LC2" class="line" lang="shell"><span class="s1">     rc=0</span></span>
<span id="LC3" class="line" lang="shell"><span class="s1">     unset myrandom</span></span>
<span id="LC4" class="line" lang="shell"><span class="s1">     while test $rc = 0; do</span></span>
<span id="LC5" class="line" lang="shell"><span class="s1">         if test -n "$RANDOM"; then myrandom=$(($RANDOM + $RANDOM)); fi</span></span>
<span id="LC6" class="line" lang="shell"><span class="s1">         if test -z "$myrandom"; then myrandom=$(date +%N | sed s/^0*//); fi</span></span>
<span id="LC7" class="line" lang="shell"><span class="s1">         if test -z "$myrandom"; then myrandom=0; fi</span></span>
<span id="LC8" class="line" lang="shell"><span class="s1">         PORT="$(((($$<<15)|$myrandom) % 63001 + 2000))"</span></span>
<span id="LC9" class="line" lang="shell"><span class="s1">         check_if_port_in_use $PORT;rc=$?</span></span>
<span id="LC10" class="line" lang="shell"><span class="s1">     done</span></span>
<span id="LC11" class="line" lang="shell"><span class="s1">'</span></span></code></pre>
<copy-code></copy-code>
</div>
<p dir="auto">IF $RANDOM is not available myrandom never changes in the loop. Moving <code>unset myrandom</code> inside the loop should work. - Will post a merge request later.</p>
<p dir="auto">cu Andreas</p>

</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #666;">

<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/-/issues/1315">view it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can
<a href="https://gitlab.com/-/sent_notifications/fadeb500af0186c7e9ff327b4a8887fd/unsubscribe">unsubscribe</a>
from this thread or
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.com/gnutls/gnutls/-/issues/1315"}}</script>


</p>
</div>
</body>
</html>