From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: richardeng Newsgroups: gmane.emacs.bugs,gmane.emacs.pretest.bugs Subject: bug#1688: 23.0.60; ttname returned by system-process-attributes points to nonexisting file Date: Fri, 16 Jan 2009 18:22:08 +0800 Message-ID: <49705FD0.6090006@foxmail.com> References: <877i5q2ij9.fsf@broken.deisui.org> <496B7B23.9070203@foxmail.com> Reply-To: richardeng , 1688@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1232102628 17669 80.91.229.12 (16 Jan 2009 10:43:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 16 Jan 2009 10:43:48 +0000 (UTC) Cc: emacs-pretest-bug@gnu.org, ueno@unixuser.org, bug-gnu-emacs@gnu.org, 1688@emacsbugs.donarmstrong.com To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 16 11:45:00 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LNmC9-0007U7-Bj for geb-bug-gnu-emacs@m.gmane.org; Fri, 16 Jan 2009 11:44:57 +0100 Original-Received: from localhost ([127.0.0.1]:53779 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNmAs-0004R6-Ar for geb-bug-gnu-emacs@m.gmane.org; Fri, 16 Jan 2009 05:43:38 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LNmAl-0004Pk-OK for bug-gnu-emacs@gnu.org; Fri, 16 Jan 2009 05:43:31 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LNmAk-0004Of-UM for bug-gnu-emacs@gnu.org; Fri, 16 Jan 2009 05:43:31 -0500 Original-Received: from [199.232.76.173] (port=37852 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNmAj-0004OG-Uy for bug-gnu-emacs@gnu.org; Fri, 16 Jan 2009 05:43:30 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:43834) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LNmAj-0004dr-BA for bug-gnu-emacs@gnu.org; Fri, 16 Jan 2009 05:43:29 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0GAhQJq029605; Fri, 16 Jan 2009 02:43:26 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n0GAU6D4025616; Fri, 16 Jan 2009 02:30:06 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: richardeng Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Fri, 16 Jan 2009 10:30:05 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 1688 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 1688-submit@emacsbugs.donarmstrong.com id=B1688.123210136723812 (code B ref 1688); Fri, 16 Jan 2009 10:30:05 +0000 Original-Received: (at 1688) by emacsbugs.donarmstrong.com; 16 Jan 2009 10:22:47 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from smtpbg3.foxmail.com (smtpbg3.foxmail.com [121.14.102.33]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id n0GAMgrK023798 for <1688@emacsbugs.donarmstrong.com>; Fri, 16 Jan 2009 02:22:44 -0800 Original-Received: from 172.25.76.137 (foxmail.com [172.25.76.137]) by smtpbg3 (foxmail.com) with SMTP id lZhNjMLi; Fri, 16 Jan 2009 18:22:21 +0800 (envelope-from richardeng@foxmail.com) X-QQ-mid: esmtp2123210134123212825 Original-Received: from [192.168.1.111] (unknown [58.25.221.212]) by esmtp2.foxmail.com (ESMTP) with id ; Fri, 16 Jan 2009 18:22:12 +0800 (CST) User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Fri, 16 Jan 2009 05:43:31 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:24202 gmane.emacs.pretest.bugs:23699 Archived-At: Stefan Monnier wrote: >>> --- sysdep.c.~1.328.~ 2009-01-03 07:04:59.000000000 -0800 >>> +++ sysdep.c 2009-01-13 01:09:56.000000000 -0800 >>> @@ -3322,7 +3322,7 @@ >>> >>> if (MINOR (rdev) >= minor_beg && MINOR (rdev) <= minor_end) >>> { >>> - sprintf (name + strlen (name), "%lu", MINOR (rdev)); >>> + sprintf (name + strlen (name), "/%lu", MINOR (rdev)); >>> break; >>> } >>> >> It's not that simple: what happens if `name' is something like "ptys" >> or "tty"? We need to generate "ptys2" and "tty39" for them, not >> "ptys/2" and "tty/39". >> > > Indeed, it's pretty messy. Even just procfs_ttyname in itself is pretty > messy (not its implementation, but the need to go through those hoops). > > >> Faced with this difficulty, I decided not to bother, since the value >> of `ttname' is not documented to return a valid file name. >> > > >> Perhaps some Linux guru (which I ain't) can suggest an easy solution. >> > > I think it's OK for now. When we really need something better, we'll > just look at the `ps' code. > > > Stefan > > > check ISDIR first --- sysdep.c.~1.328.~ 2009-01-03 07:04:59.000000000 -0800 +++ sysdep.c 2009-01-15 02:03:07.000000000 -0800 @@ -3322,7 +3322,11 @@ if (MINOR (rdev) >= minor_beg && MINOR (rdev) <= minor_end) { - sprintf (name + strlen (name), "%lu", MINOR (rdev)); + struct stat st_addr; + if (!stat (name, &st_addr) && S_ISDIR(st_addr.st_mode)) + sprintf (name + strlen (name), "/%lu", MINOR (rdev)); + else + sprintf (name + strlen (name), "%lu", MINOR (rdev)); break; } }