From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/2681 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: tomas.volf@showmax.com Newsgroups: gmane.comp.sysutils.supervision.general Subject: stdout of check script (change proposal) Date: Wed, 16 Oct 2019 09:03:54 +0200 Message-ID: <20191016070354.6krcu2v45msevxhb@showmax.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="wtnhslm6htsfncnc" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="58834"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: NeoMutt/20180716 Cc: david.cepelik@showmax.com To: supervision@list.skarnet.org Original-X-From: supervision-return-2270-gcsg-supervision=m.gmane.org@list.skarnet.org Wed Oct 16 09:04:03 2019 Return-path: Envelope-to: gcsg-supervision@m.gmane.org Original-Received: from alyss.skarnet.org ([95.142.172.232]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1iKdLm-000F5a-L2 for gcsg-supervision@m.gmane.org; Wed, 16 Oct 2019 09:04:02 +0200 Original-Received: (qmail 316 invoked by uid 89); 16 Oct 2019 07:04:23 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm Original-Sender: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Original-Received: (qmail 309 invoked from network); 16 Oct 2019 07:04:23 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=showmax.com; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=bt8pVER+gkXnQJL/wpLsx6/FzWVjolNksc+AwBOVrZg=; b=AClCc+laXeR7ZKdyuXjbYZAUl3iyRpcBi/JebC3OcgawKirEt/me46Mw61L7FiUCN4 eDaEk/L7LMB5sXULsa4+io4wTYVPGCGhb+KNKCy5C4VUAZfO+cAVGMplgqmk7tmjVD1X BDEA8raCRUt3XxBc8RMXrauuKgUhv6g3Udz0Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=bt8pVER+gkXnQJL/wpLsx6/FzWVjolNksc+AwBOVrZg=; b=Sp0ZD8CnOsmzZIc6BkzVW8ypRKFYR5Iij/nYQ/DS0KIxXRhqgEWVns42Dohl1e5jp1 tBNYppwio9nCC3Ri9+mm/NuowM/syxCaY3KKE0Cgt/CeYbyDVXmwDxrgQ8HAUB/BiyVF ulURAoqfyOtA0Oo5XcNt4XiNHaTgvGdVXqau33qtcVzoMesTSTe8FrbEYGHVaGbA7V04 cKEYbCCvGeQoTUZUNiksqoP+FWoJ0dNl5DycXGkr61z3H0bcJm1+Oj8HPA6kbxG3XDRq /5ROE//zouSdyRQC296MIwPoqWRFOhVczvFmLGx4J7EdYxmXQ7gXdWgn/tPHLFdil33K tw+w== X-Gm-Message-State: APjAAAWvD9apS2Qr4KmQO1nTIAgUMpuQ1H6QZ9njBm2jYa4nKrGvqlnR F2tUr0wvm/YVqBgtrPH+BEAaxUIMQ3cfyA== X-Google-Smtp-Source: APXvYqxrgNh3BT4zlaMhrEy7zRA802XrjeztWd+CijRu70cjqCPqmgg6cZgcSinonhLOM6WvnoELvw== X-Received: by 2002:a5d:5052:: with SMTP id h18mr1302915wrt.143.1571209435651; Wed, 16 Oct 2019 00:03:55 -0700 (PDT) Content-Disposition: inline Xref: news.gmane.org gmane.comp.sysutils.supervision.general:2681 Archived-At: --wtnhslm6htsfncnc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, I would like to propose a small change in runit. I was surprised by the way runit executes the check script. Looking at the current sources from the tarball (2.1.2), I've noticed that stdout is closed before check script gets execve'd: admin/runit-2.1.2/src/sv.c: 195 if (!pid) { 196 prog[0] =3D"./check"; 197 prog[1] =3D0; 198 close(1); 199 execve("check", prog, environ); Perhaps there's some motivation I don't know? I would propose one of the following: a) keep both stdout and stderr open, b) close both stdout and stderr, c) if we don't care about the output, dup2 both to /dev/null. The current behavior can be a bit confusing. For example, we exec 2>&1 in most of our run-files so that output of the entire script is logged with svlogd. If you attempt to do that in the check file, the script will crash (because FD 1 is closed) and if you're using dash, you won't even get an error message (that's another bug to be fixed which was discovered while debugging the check script issue). a) has the advantage of seeing the output of the check script when issuing commands on the terminal. If we can agree on a solution, we are more than happy to provide a patch for this. Big thanks for runit! Regards W. --=20 There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. --wtnhslm6htsfncnc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEbuzFYPedNDVaYM+cz0jbvQIlXjMFAl2mwNoACgkQz0jbvQIl XjOO+Q//ZxjltkIvXDnZrg5oHdPvZUZ2tYBT6IXPT66dGObeixTbge6CLbtXeine XWiY6z7IDrShr42mABqnLPoBINlt+EAVAEP/n5uTQZS7NsQnmWxDTvXCS8IQPzke 5qEJYrMcH6MVx9G4uamhkagm1qvgw15mjzeBGxRdrp5qYFaYCNLBUfghYEXOcgUW LlAdVyQB0ccsmZWo7NgzuwWJTgqBcua1O0L19bcF6ANDThYbR5PL6aNLCPKgNCQD x/PKlkmt23n9SJXTKuTU8g5Nw4ZiLNAXDnBK9VCCBqBrIK3x0qL/0b8tYOxPqlU3 wsO3FK1VBE0YOhpOj/phNF/E0vC3qBLY8caG4LkT2nrPA1wMgxcbH+m+MCl37x0T ZBxn1YeOPCtKyUOipKmAtYq1HPJ/KCfbPUiP9vwe83243s2EMQkjy7Hk1bnpFt7O /uKC+E+C24FQRq8EJWF1PzB2HTDSXhkCDHX3jiZutvAAi8syKRrirVWWxKvAEluN SrTnBoPJ5M7p7dHKd1H7q7pCuf1D4nNOYjceFR/6UeGBQka5ywOSp+PIjqvaV9DH xKWFYYM9KzBJsGiWETgJ/3SIGhIkruy65UAG3cSa2jXUp14JhJp/Pthd70GzWmhJ SBqABb0uPqHUDz1+en+wVfytVykUyVaYlbs8WsTn+OkfCJMYt38= =WFGq -----END PGP SIGNATURE----- --wtnhslm6htsfncnc--