From: Christian Weisgerber Subject: Re: regress: do not use job control in a non-interactive shell To: gameoftrees@openbsd.org Date: Mon, 27 May 2024 17:26:52 +0200 Stefan Sperling: > > Also do not use the non-standard timeout(1) utility. Explicitly > > terminate the background server process in all exit paths. > > Should we use a custom perl script that times out internally? In regress/cmdline, the http-server keeps running indefinitely until explicitly terminated. In regress/gotd, nc and http-server exit on their own after one connection. My patch only addressed regress/cmdline and doesn't generalize to regress/gotd. I thought I'd look how the curl regression suite handles this, as it fires up all sorts of servers, but that's too much code... both for me to quickly understand what it does, and to copy that approach. > The idea to use timeout(1) came to me because nc -l has no option to let > the server process time out. Which means tests could potentially hang > forever instead of failing. In practice, timeout(1) is now available across Linux and all BSDs (Free, Net, Open, Dragonfly), so I guess avoiding it is a pointless exercise. I'm still unhappy about * the use of %1 in a non-interactive shell, * setting but never resetting a trap that swats at some process, * exiting on error without terminating the server and relying on timeout to kill it. -- Christian "naddy" Weisgerber naddy@mips.inka.de