Re: [PATCH] test/emacs: replace the use of process-attributes with kill(1)
authorTomi Ollila <tomi.ollila@iki.fi>
Sat, 11 Jan 2014 10:14:37 +0000 (12:14 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:58:56 +0000 (09:58 -0800)
8a/2af49f19f77d94a2abea610fad3014b6c9c2f7 [new file with mode: 0644]

diff --git a/8a/2af49f19f77d94a2abea610fad3014b6c9c2f7 b/8a/2af49f19f77d94a2abea610fad3014b6c9c2f7
new file mode 100644 (file)
index 0000000..eeeeed1
--- /dev/null
@@ -0,0 +1,117 @@
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 453C2431FC3\r
+       for <notmuch@notmuchmail.org>; Sat, 11 Jan 2014 02:14:52 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id QePZxCG0o7EE for <notmuch@notmuchmail.org>;\r
+       Sat, 11 Jan 2014 02:14:44 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id 9CFBF431FC0\r
+       for <notmuch@notmuchmail.org>; Sat, 11 Jan 2014 02:14:44 -0800 (PST)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+       by guru.guru-group.fi (Postfix) with ESMTP id 6201A10005E;\r
+       Sat, 11 Jan 2014 12:14:38 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] test/emacs: replace the use of process-attributes with\r
+       kill(1)\r
+In-Reply-To: <1389407778-15724-1-git-send-email-david@tethera.net>\r
+References: <87a9ffofsc.fsf@zancas.localnet>\r
+       <1389407778-15724-1-git-send-email-david@tethera.net>\r
+User-Agent: Notmuch/0.17+23~ga575e35 (http://notmuchmail.org) Emacs/24.3.1\r
+       (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+       $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+       !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Sat, 11 Jan 2014 12:14:37 +0200\r
+Message-ID: <m2bnziygdu.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 11 Jan 2014 10:14:52 -0000\r
+\r
+On Sat, Jan 11 2014, David Bremner <david@tethera.net> wrote:\r
+\r
+> In some environments (at least Hurd), process-attributes is\r
+> unimplimented and always returns nil.  This ends up causing test\r
+> failures (see e.g. id:87a9ffofsc.fsf@zancas.localnet).\r
+>\r
+> According to POSIX 1003.1-2001, a signal of 0 can be used to check the\r
+> validity of a pid. This seems less heinous than parsing the output of ps(1).\r
+> ---\r
+\r
+This has been pretty portable method long before 2001 :D\r
+\r
+You could replace the  call-process with\r
+\r
+(signal-process pid 0)\r
+\r
+Tomi\r
+\r
+>\r
+> I'm not sure if it would be worthwhile, but a point release could\r
+> finally get notmuch compiling on Hurd again.  At least the test in the parent message does pass on Hurd with this patch\r
+>\r
+>  test/test-lib.el | 15 +++++++++------\r
+>  1 file changed, 9 insertions(+), 6 deletions(-)\r
+>\r
+> diff --git a/test/test-lib.el b/test/test-lib.el\r
+> index d26b49f..93f5f72 100644\r
+> --- a/test/test-lib.el\r
+> +++ b/test/test-lib.el\r
+> @@ -77,19 +77,22 @@ invisible text."\r
+>      (setq start next-pos)))\r
+>      str))\r
+>  \r
+> +;; process-attributes is not defined everywhere, so define an\r
+> +;; alternate way to test if a process still exists.\r
+> +\r
+> +(defun test-process-running (pid)\r
+> +  (= 0\r
+> +   (call-process "kill" nil nil nil "-0" (int-to-string pid))))\r
+> +\r
+>  (defun orphan-watchdog-check (pid)\r
+>    "Periodically check that the process with id PID is still\r
+>  running, quit if it terminated."\r
+> -  (if (not (process-attributes pid))\r
+> +  (if (not (test-process-running pid))\r
+>        (kill-emacs)))\r
+>  \r
+>  (defun orphan-watchdog (pid)\r
+>    "Initiate orphan watchdog check."\r
+> -  ; If process-attributes returns nil right away, that probably means\r
+> -  ; it is unimplimented. So we delay two minutes before killing emacs.\r
+> -  (if (process-attributes pid)\r
+> -      (run-at-time 60 60 'orphan-watchdog-check pid)\r
+> -    (run-at-time 120 60 'orphan-watchdog-check pid)))\r
+> +  (run-at-time 60 60 'orphan-watchdog-check pid))\r
+>  \r
+>  (defun hook-counter (hook)\r
+>    "Count how many times a hook is called.  Increments\r
+> -- \r
+> 1.8.5.2\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r