bugzilla-daemon at bugzilla.mindrot.org
2010-Apr-09 17:39 UTC
[Bug 1752] New: Test port not available during make tests
https://bugzilla.mindrot.org/show_bug.cgi?id=1752
Summary: Test port not available during make tests
Product: Portable OpenSSH
Version: 5.4p1
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Build system
AssignedTo: unassigned-bugs at mindrot.org
ReportedBy: petesea at bigfoot.com
While building the latest OpenSSH from CVS (2010-04-09), "make tests"
fails with the error "no sshd running on port 4242". The real cause
in
my case is that something is already running on port 4242 (the Juniper
Network Connect client).
It would be nice if the error message were a bit more helpful, eg:
no sshd running on port 4242, try setting $TEST_SSH_PORT to a
different port
To go a step further, it might be nice if the code used to set the port
was a bit more resilient, with an error message more informative.
Maybe the code in test-exec.sh:
if [ ! -z "$TEST_SSH_PORT" ]; then
PORT="$TEST_SSH_PORT"
else
PORT=4242
fi
could be something similar to:
if [ ! -z "$TEST_SSH_PORT" ]; then
PORT="$TEST_SSH_PORT"
else
first_port=4200
last_port=4300
test_port=$first_port
while [ "$test_port" -le "$last_port" ]; do
netstat -na | grep "[:.]$test_port " >/dev/null 2>&1
|| {
PORT=$test_port; break; }
test_port=`expr $test_port + 1`
done
if [ -z "$PORT" ]; then
echo "Unable to find usable test port between $first_port and
$last_port. Define \$TEST_SSH_PORT."
exit 2
fi
fi
I realize the 'netstat | grep' command above may not be the best, most
portable way to look for an available port, but the idea is the same...
ie. run something that checks to see if the requested port is available
or not. FYI, I did run the above code on several boxes (solaris, hpux,
macosx, fedora, redhat, centos, cygwin) and it seemed to work fine.
Another possible way to check would be to run sshd -D and look at the
output. In my case it says:
Bind to port 4242 on 127.0.0.1 failed: Address already in use.
Cannot bind any address.
Which (again in my particular case), would have been a much more
helpful error message then "no sshd running on port 4242".
Unfortunately, with this approach the sshd command would need to be
killed/terminated somehow.
Or... maybe the sshd -t (or -T) option could be enhanced (or a new
option created) that checks to see if the port is available, but
doesn't actually start a server. I suspect this really means it would
try to bind to that port and then just close if it works, otherwise
report the error. Problem is, on some systems I believe it can take a
while before a port can be reused... so a passive check may be better.
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2010-Apr-23 00:50 UTC
[Bug 1752] Test port not available during make tests
https://bugzilla.mindrot.org/show_bug.cgi?id=1752
Darren Tucker <dtucker at zip.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dtucker at zip.com.au
--- Comment #1 from Darren Tucker <dtucker at zip.com.au> 2010-04-23
10:50:28 EST ---
The sshd port isn't the only port this can happen to, it can also
happen during the port forwarding tests which use different ports. It
might be worth adding the test you suggest (doing it portably is hard
though).
I agree that the error reporting from the tests is not very good, and
that debugging tests is tricky. I attempted to add a wrapper to catch
the debug output on stderr but that was not very successful.
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2010-Apr-23 00:52 UTC
[Bug 1752] Test port not available during make tests
https://bugzilla.mindrot.org/show_bug.cgi?id=1752
Darren Tucker <dtucker at zip.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Blocks| |1708
Component|Build system |Regression tests
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2010-Aug-09 18:25 UTC
[Bug 1752] Test port not available during make tests
https://bugzilla.mindrot.org/show_bug.cgi?id=1752
Damien Miller <djm at mindrot.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |djm at mindrot.org
Status|NEW |RESOLVED
Resolution| |WONTFIX
--- Comment #2 from Damien Miller <djm at mindrot.org> ---
I think any attempts to check for an open port using netstat or similar
are doomed to fail because of cross-platform incompatibilities. Users
of the test scripts should just arrange for the port to be free on the
systems they test under or edit test-exec.sh to pick a new, free port
there.
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2010-Aug-09 18:38 UTC
[Bug 1752] Test port not available during make tests
https://bugzilla.mindrot.org/show_bug.cgi?id=1752 --- Comment #3 from petesea at bigfoot.com --- (In reply to comment #2)> I think any attempts to check for an open port using netstat or similar > are doomed to fail because of cross-platform incompatibilities. Users > of the test scripts should just arrange for the port to be free on the > systems they test under or edit test-exec.sh to pick a new, free port > there.Understood. How about just making the error message a bit more clear? eg: no sshd running on port 4242, try setting $TEST_SSH_PORT to a different port That way, at least users who encounter this problem don't need to go digging around to figure out the solution is to set $TEST_SSH_PORT. -- Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2010-Aug-27 00:28 UTC
[Bug 1752] Test port not available during make tests
https://bugzilla.mindrot.org/show_bug.cgi?id=1752
Darren Tucker <dtucker at zip.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |CLOSED
--- Comment #4 from Darren Tucker <dtucker at zip.com.au> ---
With the release of OpenSSH 5.6p1 this bug is now considered closed.
If you have further problems please reopen or file a new bug as
appropriate.
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.