unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#1688: 23.0.60; ttname returned by system-process-attributes points to nonexisting file
@ 2008-12-24  6:28 Daiki Ueno
  2009-01-12 17:17 ` richardeng
  2009-01-12 18:00 ` richardeng
  0 siblings, 2 replies; 10+ messages in thread
From: Daiki Ueno @ 2008-12-24  6:28 UTC (permalink / raw)
  To: emacs-pretest-bug

Hello,

Try to start Emacs with emacs -Q -nw on xterm, and then evaluate the
following expression:

(assq 'ttname (system-process-attributes (emacs-pid)))
=> (ttname . "/dev/pts17")

A "/" is missing between "pts" and "17".

(file-exists-p "/dev/pts17")
=> nil
(file-exists-p "/dev/pts/17")
=> t

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/local/share/emacs/23.0.60/etc/DEBUG for instructions.


In GNU Emacs 23.0.60.1 (i686-pc-linux-gnu, GTK+ Version 2.12.11)
 of 2008-12-24 on p360
Windowing system distributor `The X.Org Foundation', version 11.0.10402000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ja_JP.UTF-8
  value of $XMODIFIERS: @im=SCIM
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  which-function-mode: t
  icomplete-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<escape> x r e p o r t SPC e m a <tab> b <backspace> 
<return>

Recent messages:
Loading mime-setup...done
`completer' is not found.
`habbrev' is not found.
Loading remem...done
Loading /home/ueno/.emacs/init.el (source)...done
Loading /home/ueno/.emacs/custom.el (source)...
Loading icomplete...done
Loading which-func...done
Loading /home/ueno/.emacs/custom.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.

-- 
Daiki Ueno






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1688: 23.0.60; ttname returned by system-process-attributes points to nonexisting file
  2008-12-24  6:28 bug#1688: 23.0.60; ttname returned by system-process-attributes points to nonexisting file Daiki Ueno
@ 2009-01-12 17:17 ` richardeng
  2009-01-12 19:19   ` Eli Zaretskii
  2009-01-12 18:00 ` richardeng
  1 sibling, 1 reply; 10+ messages in thread
From: richardeng @ 2009-01-12 17:17 UTC (permalink / raw)
  To: Daiki Ueno, 1688; +Cc: emacs-pretest-bug

Daiki Ueno wrote:
> Hello,
>
> Try to start Emacs with emacs -Q -nw on xterm, and then evaluate the
> following expression:
>
> (assq 'ttname (system-process-attributes (emacs-pid)))
> => (ttname . "/dev/pts17")
>
> A "/" is missing between "pts" and "17".
>
> (file-exists-p "/dev/pts17")
> => nil
> (file-exists-p "/dev/pts/17")
> => t
>
> If Emacs crashed, and you have the Emacs process in the gdb debugger,
> please include the output from the following gdb commands:
>     `bt full' and `xbacktrace'.
> If you would like to further debug the crash, please read the file
> /usr/local/share/emacs/23.0.60/etc/DEBUG for instructions.
>
>
> In GNU Emacs 23.0.60.1 (i686-pc-linux-gnu, GTK+ Version 2.12.11)
>  of 2008-12-24 on p360
> Windowing system distributor `The X.Org Foundation', version 11.0.10402000
> Important settings:
>   value of $LC_ALL: nil
>   value of $LC_COLLATE: nil
>   value of $LC_CTYPE: nil
>   value of $LC_MESSAGES: nil
>   value of $LC_MONETARY: nil
>   value of $LC_NUMERIC: nil
>   value of $LC_TIME: nil
>   value of $LANG: ja_JP.UTF-8
>   value of $XMODIFIERS: @im=SCIM
>   locale-coding-system: utf-8-unix
>   default-enable-multibyte-characters: t
>
> Major mode: Lisp Interaction
>
> Minor modes in effect:
>   which-function-mode: t
>   icomplete-mode: t
>   tooltip-mode: t
>   mouse-wheel-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   global-auto-composition-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   column-number-mode: t
>   line-number-mode: t
>   transient-mark-mode: t
>
> Recent input:
> <escape> x r e p o r t SPC e m a <tab> b <backspace> 
> <return>
>
> Recent messages:
> Loading mime-setup...done
> `completer' is not found.
> `habbrev' is not found.
> Loading remem...done
> Loading /home/ueno/.emacs/init.el (source)...done
> Loading /home/ueno/.emacs/custom.el (source)...
> Loading icomplete...done
> Loading which-func...done
> Loading /home/ueno/.emacs/custom.el (source)...done
> For information about GNU Emacs and the GNU system, type C-h C-a.
>
>   
--- 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;                                                                                       

                
}                                                                                              

            }                                







^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1688: 23.0.60; ttname returned by system-process-attributes points to nonexisting file
  2008-12-24  6:28 bug#1688: 23.0.60; ttname returned by system-process-attributes points to nonexisting file Daiki Ueno
  2009-01-12 17:17 ` richardeng
@ 2009-01-12 18:00 ` richardeng
  1 sibling, 0 replies; 10+ messages in thread
From: richardeng @ 2009-01-12 18:00 UTC (permalink / raw)
  To: Daiki Ueno, 1688; +Cc: emacs-pretest-bug

Daiki Ueno wrote:
> Hello,
>
> Try to start Emacs with emacs -Q -nw on xterm, and then evaluate the
> following expression:
>
> (assq 'ttname (system-process-attributes (emacs-pid)))
> => (ttname . "/dev/pts17")
>
> A "/" is missing between "pts" and "17".
>
> (file-exists-p "/dev/pts17")
> => nil
> (file-exists-p "/dev/pts/17")
> => t
>
> If Emacs crashed, and you have the Emacs process in the gdb debugger,
> please include the output from the following gdb commands:
>     `bt full' and `xbacktrace'.
> If you would like to further debug the crash, please read the file
> /usr/local/share/emacs/23.0.60/etc/DEBUG for instructions.
>
>
> In GNU Emacs 23.0.60.1 (i686-pc-linux-gnu, GTK+ Version 2.12.11)
>  of 2008-12-24 on p360
> Windowing system distributor `The X.Org Foundation', version 11.0.10402000
> Important settings:
>   value of $LC_ALL: nil
>   value of $LC_COLLATE: nil
>   value of $LC_CTYPE: nil
>   value of $LC_MESSAGES: nil
>   value of $LC_MONETARY: nil
>   value of $LC_NUMERIC: nil
>   value of $LC_TIME: nil
>   value of $LANG: ja_JP.UTF-8
>   value of $XMODIFIERS: @im=SCIM
>   locale-coding-system: utf-8-unix
>   default-enable-multibyte-characters: t
>
> Major mode: Lisp Interaction
>
> Minor modes in effect:
>   which-function-mode: t
>   icomplete-mode: t
>   tooltip-mode: t
>   mouse-wheel-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   global-auto-composition-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   column-number-mode: t
>   line-number-mode: t
>   transient-mark-mode: t
>
> Recent input:
> <escape> x r e p o r t SPC e m a <tab> b <backspace> 
> <return>
>
> Recent messages:
> Loading mime-setup...done
> `completer' is not found.
> `habbrev' is not found.
> Loading remem...done
> Loading /home/ueno/.emacs/init.el (source)...done
> Loading /home/ueno/.emacs/custom.el (source)...
> Loading icomplete...done
> Loading which-func...done
> Loading /home/ueno/.emacs/custom.el (source)...done
> For information about GNU Emacs and the GNU system, type C-h C-a.
>
>   
send again, "plain text only" has format problem...

--- 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;                                                                                       

                
}                                                                                              

            }            







^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1688: 23.0.60; ttname returned by system-process-attributes points to nonexisting file
  2009-01-12 17:17 ` richardeng
@ 2009-01-12 19:19   ` Eli Zaretskii
  2009-01-12 21:04     ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2009-01-12 19:19 UTC (permalink / raw)
  To: richardeng, 1688; +Cc: emacs-pretest-bug, bug-gnu-emacs, ueno

> Date: Tue, 13 Jan 2009 01:17:23 +0800
> From: richardeng <richardeng@foxmail.com>
> Cc: emacs-pretest-bug@gnu.org
> 
> --- 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".

So a more complex logic is required here.

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.







^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1688: 23.0.60; ttname returned by system-process-attributes points to nonexisting file
  2009-01-12 19:19   ` Eli Zaretskii
@ 2009-01-12 21:04     ` Stefan Monnier
  2009-01-16 10:22       ` richardeng
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2009-01-12 21:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-pretest-bug, bug-gnu-emacs, ueno, 1688

>> --- 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







^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1688: 23.0.60; ttname returned by system-process-attributes points to nonexisting file
  2009-01-12 21:04     ` Stefan Monnier
@ 2009-01-16 10:22       ` richardeng
  2009-01-16 21:00         ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: richardeng @ 2009-01-16 10:22 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-pretest-bug, ueno, bug-gnu-emacs, 1688

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;                                                                                       
                }                                                                                              
            }       










^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1688: 23.0.60; ttname returned by system-process-attributes points to nonexisting file
  2009-01-16 10:22       ` richardeng
@ 2009-01-16 21:00         ` Stefan Monnier
  2009-01-17 11:51           ` richardeng
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2009-01-16 21:00 UTC (permalink / raw)
  To: richardeng; +Cc: emacs-pretest-bug, ueno, bug-gnu-emacs, 1688

> check ISDIR first

It's a good heursitic, but it's still just a heuristic.
You may have a /dev/tty directory and still use /dev/tty1.
Maybe it's better to get rid of the "/dev/" prefix to make it more clear
that it's not really a valid file name.


        Stefan






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1688: 23.0.60; ttname returned by system-process-attributes points to nonexisting file
  2009-01-16 21:00         ` Stefan Monnier
@ 2009-01-17 11:51           ` richardeng
  2009-01-18 20:57             ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: richardeng @ 2009-01-17 11:51 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-pretest-bug, ueno, bug-gnu-emacs, 1688

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]

Stefan Monnier wrote:
>> check ISDIR first
>>     
>
> It's a good heursitic, but it's still just a heuristic.
> You may have a /dev/tty directory and still use /dev/tty1.
> Maybe it's better to get rid of the "/dev/" prefix to make it more clear
> that it's not really a valid file name.
>
>
>         Stefan
>
>
>   
you mean /dev/tty1 and /dev/tty/1 will exist at the same time?
It won't as I know in linux

procfs_ttyname should return a full path of the ttyname, or at least one function can return the fullpath.


[-- Attachment #2: Type: text/html, Size: 934 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1688: 23.0.60; ttname returned by system-process-attributes points to nonexisting file
  2009-01-17 11:51           ` richardeng
@ 2009-01-18 20:57             ` Stefan Monnier
  2011-07-10 14:36               ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2009-01-18 20:57 UTC (permalink / raw)
  To: richardeng; +Cc: emacs-pretest-bug, ueno, bug-gnu-emacs, 1688

>> It's a good heursitic, but it's still just a heuristic.
>> You may have a /dev/tty directory and still use /dev/tty1.
>> Maybe it's better to get rid of the "/dev/" prefix to make it more clear
>> that it's not really a valid file name.
> you mean /dev/tty1 and /dev/tty/1 will exist at the same time?

No, I mean both /dev/tty1 being the device you want and /dev/tty being
a directory.  Rather than ISDIR you could indeed just check which of
/dev/tty1 and /dev/tty/1 exists and if only one exists then you should
be pretty sure which answer is the right one.  If they both exist (or
if neither exists), it's much less clear what to do.

> It won't as I know in Linux

That depends on the dev layout chosen by the distribution/user/...
I.e. it's a heuristic.

> procfs_ttyname should return a full path of the ttyname, or at least
> one function can return the fullpath.

Why?


        Stefan






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1688: 23.0.60; ttname returned by system-process-attributes points to nonexisting file
  2009-01-18 20:57             ` Stefan Monnier
@ 2011-07-10 14:36               ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 10+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-10 14:36 UTC (permalink / raw)
  To: 1688

I think the conclusion here was to do nothing:

> I think it's OK for now.  When we really need something better, we'll
> just look at the `ps' code.

So I'm closing the report.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-07-10 14:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-24  6:28 bug#1688: 23.0.60; ttname returned by system-process-attributes points to nonexisting file Daiki Ueno
2009-01-12 17:17 ` richardeng
2009-01-12 19:19   ` Eli Zaretskii
2009-01-12 21:04     ` Stefan Monnier
2009-01-16 10:22       ` richardeng
2009-01-16 21:00         ` Stefan Monnier
2009-01-17 11:51           ` richardeng
2009-01-18 20:57             ` Stefan Monnier
2011-07-10 14:36               ` Lars Magne Ingebrigtsen
2009-01-12 18:00 ` richardeng

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).