In order bind the debuginfod server on any port (e.g. for testing) you might want to start it using debuginfod --port=0 When you do that, the logs say: started http server on IPv4 IPv6 port=0 IMHO debuginfod should print the port that was actually assigned by the operating system.
Is this behavior actually useful or does --port=0 work by accident? I don't see this (http_port == 0) documented for MHD_start_daemon. So I would actually just reject it: diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx index 7c7e85eb..39736351 100644 --- a/debuginfod/debuginfod.cxx +++ b/debuginfod/debuginfod.cxx @@ -422,7 +422,8 @@ parse_opt (int key, char *arg, case 'v': verbose ++; break; case 'd': db_path = string(arg); break; case 'p': http_port = (unsigned) atoi(arg); - if (http_port > 65535) argp_failure(state, 1, EINVAL, "port number"); + if (http_port == 0 || http_port > 65535) + argp_failure(state, 1, EINVAL, "port number"); break; case 'F': scan_files = true; break; case 'R':
Proposed to just disable this undocumented "feature" because it doesn't seem very useful: https://sourceware.org/pipermail/elfutils-devel/2020q1/002568.html
pushed this to master, along with a tiny man page blurb.