GNU bug report logs - #1688
23.0.60; ttname returned by system-process-attributes points to nonexisting file

Previous Next

Package: emacs;

Reported by: Daiki Ueno <ueno <at> unixuser.org>

Date: Wed, 24 Dec 2008 07:05:04 UTC

Severity: minor

Tags: wontfix

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #62 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: richardeng <richardeng <at> foxmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 1688 <at> debbugs.gnu.org,
        emacs-pretest-bug <at> gnu.org, bug-gnu-emacs <at> gnu.org, ueno <at> unixuser.org
Subject: Re: bug#1688: 23.0.60; ttname returned by system-process-attributes
 points to nonexisting file
Date: Fri, 16 Jan 2009 18:22:08 +0800
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;                                                                                       
               }                                                                                              
           }       








This bug report was last modified 14 years and 12 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.