> If we can't rely on error messages (which seems like the best approach > -- then we will test this aspect of the tool as well), we should be able > to write a small tool that tries to bind a particular port. This tool > could replace InetUtils' use of netstat. > > I wrote such a tool once, port-open-p, but never had time to > polish it up and commit it. I think we should do this after > release, but then I'm not in a hurry. Such a tool would be > useful, but syslogd should exist gracefully if it can't open a > port and report an error even if we have such a tool.
Personally, I find it reasonable to demand a basic tool like netstat(1), if it is agreed that bison(1) must be present. bison is only required for maintainers, it isn't required when you build, nor can bison be required when you run the test suite. The problem with netstat is that we want people to run `make all check install', which excludes any `non-portable' commands (of which netstat is one); having our own version of `netstat', and/or check if a port is open either via syslogd reporting it, or an explicit command would make our life a lot easier. NixOS has complained with us for demanding use of netstat, which their build daemon does not provide. On the other hand, NixOS does not even provide "/etc/services", which makes any testing of network code utterly pointless, breaking the needed library calls. True that, that is a serious bug in NisOS which makes it totally unusable for our purposes. However, in Solaris and relatives, netstat(1) produces completely different output, so the grep-patterns in our test script is utterly useless; see below for a filtered version. Some sort of micro-netstat for reporting a single occupied port, built for our tests, could be of benefit. Exactly! :-)
