From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Juanma Barranquero" Newsgroups: gmane.emacs.devel Subject: proced: ppid of process ID 0 can be 0 Date: Sat, 20 Dec 2008 03:52:40 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1229741581 28151 80.91.229.12 (20 Dec 2008 02:53:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Dec 2008 02:53:01 +0000 (UTC) To: "Emacs Devel" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 20 03:54:06 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LDrya-0002zY-42 for ged-emacs-devel@m.gmane.org; Sat, 20 Dec 2008 03:54:00 +0100 Original-Received: from localhost ([127.0.0.1]:38954 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LDrxN-0001Iu-Uw for ged-emacs-devel@m.gmane.org; Fri, 19 Dec 2008 21:52:45 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LDrxK-0001Ip-Gc for emacs-devel@gnu.org; Fri, 19 Dec 2008 21:52:42 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LDrxK-0001Ic-4a for emacs-devel@gnu.org; Fri, 19 Dec 2008 21:52:42 -0500 Original-Received: from [199.232.76.173] (port=52484 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LDrxK-0001IZ-1w for emacs-devel@gnu.org; Fri, 19 Dec 2008 21:52:42 -0500 Original-Received: from yw-out-1718.google.com ([74.125.46.158]:58933) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LDrxJ-0001vR-Or for emacs-devel@gnu.org; Fri, 19 Dec 2008 21:52:41 -0500 Original-Received: by yw-out-1718.google.com with SMTP id 9so478277ywk.66 for ; Fri, 19 Dec 2008 18:52:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=PQkkKIqdt/WbAkbLMnjtUOKxXSBDvGBOUttPz+hH+RE=; b=VZwWLN3lVrdSM9qamIdOpYP7emvfTQWdyLwvp1KdMco2Qji/57olJnI5aq7snE8UH6 zLxdsMavYNiic9aLVhy3q1i1pLhFDAJ3Eou9QqjWY0g/p0DPVgd6P7ID6YGYjZyMhswj wvGiEF1vmUKTQDsgT44ua2NLWEdNKXCkQV69s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=GT+n0KhAw0jRKJKQbndY3ImtmQXJqLzZNnYk+uURoMp+TO4CNRHDnECjxdMfcs1M86 31rcQmFEf55ALjE5wThQy05hzCIA+DpdBlbcwcelT6HIg+fhL4i/AkBGutngscUJkkKu W9g0Ial7A+/LsZWJtor3gcu32goJ3+hCeRBdM= Original-Received: by 10.100.131.13 with SMTP id e13mr2680769and.57.1229741560650; Fri, 19 Dec 2008 18:52:40 -0800 (PST) Original-Received: by 10.100.13.13 with HTTP; Fri, 19 Dec 2008 18:52:40 -0800 (PST) Content-Disposition: inline X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:107090 Archived-At: proced.el assumes at several places (for example, at `proced-filter-parents') that you can loop over the ppid, because you'll eventually find a process with no parent. That's not true with on Windows, where ppid (0) == 0. That causes a stack failure, for example, if you hit RET (`proced-refine') over the PPID of process 0. I see two ways of fixing this: either removing the assumption from proced.el, or forcing the Windows implementation of system_process_attributes to adapt. First is more correct, second is much easier (see tiny patch below). Comments? Juanma Index: src/w32.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/w32.c,v retrieving revision 1.157 diff -u -2 -r1.157 w32.c --- src/w32.c 19 Dec 2008 19:50:39 -0000 1.157 +++ src/w32.c 20 Dec 2008 02:34:39 -0000 @@ -3886,7 +3886,8 @@ } attrs = Fcons (Fcons (Qcomm, decoded_cmd), attrs); - attrs = Fcons (Fcons (Qppid, - make_fixnum_or_float (pe.th32ParentProcessID)), - attrs); + if (proc_id != 0) + attrs = Fcons (Fcons (Qppid, + make_fixnum_or_float (pe.th32ParentProcessID)), + attrs); attrs = Fcons (Fcons (Qpri, make_number (pe.pcPriClassBase)), attrs);