GNU bug report logs - #5255
23.1.90; Wrong prompt in term

Previous Next

Package: emacs;

Reported by: Fabian Ezequiel Gallina <galli.87 <at> gmail.com>

Date: Sun, 13 Dec 2009 00:05:04 UTC

Severity: normal

Merged with 5334

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 5255 in the body.
You can then email your comments to 5255 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4360; Package emacs. (Sun, 06 Sep 2009 17:00:03 GMT) Full text and rfc822 format available.

Message #3 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Fabian Ezequiel Gallina <galli.87 <at> gmail.com>
To: emacs-pretest-bug <at> gnu.org
Subject: bug#5255: 23.1.90; Wrong prompt in term
Date: Sun, 20 Dec 2009 23:44:21 -0300
In emacs 23.1 when I use M-x term the prompt is rendered correctly to
whatever is defined on the PS1 environment variable. But in 23.1.90.1 it
prompts whatever is defined in the PS1 but also before that, it prompts
0;<user>@<host>:<location>.

The steps to reproduce it are quite simple:

emacs -Q
M-x term

The prompt is rendered like this:

0;fgallina <at> cuca:~/Builds/emacs[fgallina <at> cuca emacs]$

Since my PS1 is set to

PS1='[\u@\h \W]\$ '

the expected result is:

[fgallina <at> cuca emacs]$

In GNU Emacs 23.1.90.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.18.5)
 of 2009-12-20 on cuca
Windowing system distributor `The X.Org Foundation', version 11.0.10703901
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: es_AR.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> M-x t e r m <return>
<return> l s <return> M-c <backspace> M-x <backspace>
C-c b <return> M-x r e m p o <backspace> <backspace>
<backspace> p o <tab> r <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list...

Load-path shadows:
None found.

Features:
(shadow sort mail-extr message sendmail regexp-opt ecomplete rfc822 mml
mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse
rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util
netrc time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock
sha1 hex-util hashcash mail-utils emacsbug help-mode easymenu view term
disp-table ehelp electric ring tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev loaddefs button minibuffer faces cus-face files
text-properties overlay md5 base64 format env code-pages mule custom
widget hashtable-print-readable backquote make-network-process dbusbind
system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs)


Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#5255; Package emacs. (Mon, 07 Sep 2009 21:35:04 GMT) Full text and rfc822 format available.

Message #6 received at 5255 <at> debbugs.gnu.org (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Fabian Ezequiel Gallina <galli.87 <at> gmail.com>
Cc: 5255 <at> debbugs.gnu.org
Subject: bug#5255: 23.1.90; Wrong prompt in term
Date: Tue, 22 Dec 2009 06:38:04 -0800 (PST)
Fabian Ezequiel Gallina <galli.87 <at> gmail.com> writes:

  > In emacs 23.1 when I use M-x term the prompt is rendered correctly to
  > whatever is defined on the PS1 environment variable. But in 23.1.90.1 it
  > prompts whatever is defined in the PS1 but also before that, it prompts
  > 0;<user>@<host>:<location>.
  > 
  > The steps to reproduce it are quite simple:
  > 
  > emacs -Q
  > M-x term
  > 
  > The prompt is rendered like this:
  > 
  > 0;fgallina <at> cuca:~/Builds/emacs[fgallina <at> cuca emacs]$
  > 
  > Since my PS1 is set to
  > 
  > PS1='[\u@\h \W]\$ '
  > 
  > the expected result is:
  > 
  > [fgallina <at> cuca emacs]$

I can't reproduce this.
Are you sure that your prompt is set to what you show there?  Maybe the
system default sets it to something else?

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#5255; Package emacs. (Mon, 07 Sep 2009 21:35:04 GMT) Full text and rfc822 format available.

Message #9 received at 5255 <at> debbugs.gnu.org (full text, mbox):

From: Fabian Ezequiel Gallina <galli.87 <at> gmail.com>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 5255 <at> debbugs.gnu.org
Subject: bug#5255: 23.1.90; Wrong prompt in term
Date: Tue, 22 Dec 2009 11:52:14 -0300
2009/12/22 Dan Nicolaescu <dann <at> ics.uci.edu>:
> Fabian Ezequiel Gallina <galli.87 <at> gmail.com> writes:
>
>  > In emacs 23.1 when I use M-x term the prompt is rendered correctly to
>  > whatever is defined on the PS1 environment variable. But in 23.1.90.1 it
>  > prompts whatever is defined in the PS1 but also before that, it prompts
>  > 0;<user>@<host>:<location>.
>  >
>  > The steps to reproduce it are quite simple:
>  >
>  > emacs -Q
>  > M-x term
>  >
>  > The prompt is rendered like this:
>  >
>  > 0;fgallina <at> cuca:~/Builds/emacs[fgallina <at> cuca emacs]$
>  >
>  > Since my PS1 is set to
>  >
>  > PS1='[\u@\h \W]\$ '
>  >
>  > the expected result is:
>  >
>  > [fgallina <at> cuca emacs]$
>
> I can't reproduce this.
> Are you sure that your prompt is set to what you show there?  Maybe the
> system default sets it to something else?
>

I guess I found the problem:

[fgallina <at> cuca lisp]$ env | grep PROMPT_COMMAND
PROMPT_COMMAND=echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"

Now the thing is that executing this in a normal terminal renders
nothing, as opposed to term. My guess would be that term is missing
the \033] escape sequence.


Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#5255; Package emacs. (Mon, 07 Sep 2009 21:35:04 GMT) Full text and rfc822 format available.

Message #12 received at 5255 <at> debbugs.gnu.org (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Fabian Ezequiel Gallina <galli.87 <at> gmail.com>
Cc: 5255 <at> debbugs.gnu.org
Subject: bug#5255: 23.1.90; Wrong prompt in term
Date: Tue, 22 Dec 2009 07:13:16 -0800 (PST)
Fabian Ezequiel Gallina <galli.87 <at> gmail.com> writes:

  > 2009/12/22 Dan Nicolaescu <dann <at> ics.uci.edu>:
  > > Fabian Ezequiel Gallina <galli.87 <at> gmail.com> writes:
  > >
  > >  > In emacs 23.1 when I use M-x term the prompt is rendered correctly to
  > >  > whatever is defined on the PS1 environment variable. But in 23.1.90.1 it
  > >  > prompts whatever is defined in the PS1 but also before that, it prompts
  > >  > 0;<user>@<host>:<location>.
  > >  >
  > >  > The steps to reproduce it are quite simple:
  > >  >
  > >  > emacs -Q
  > >  > M-x term
  > >  >
  > >  > The prompt is rendered like this:
  > >  >
  > >  > 0;fgallina <at> cuca:~/Builds/emacs[fgallina <at> cuca emacs]$
  > >  >
  > >  > Since my PS1 is set to
  > >  >
  > >  > PS1='[\u@\h \W]\$ '
  > >  >
  > >  > the expected result is:
  > >  >
  > >  > [fgallina <at> cuca emacs]$
  > >
  > > I can't reproduce this.
  > > Are you sure that your prompt is set to what you show there?  Maybe the
  > > system default sets it to something else?
  > >
  > 
  > I guess I found the problem:
  > 
  > [fgallina <at> cuca lisp]$ env | grep PROMPT_COMMAND
  > PROMPT_COMMAND=echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"

That looks like a bad idea.
I am guessing that you are trying to set the xterm title to display the
current directory in the shell, this uses an xterm specific escape sequence.
So it should only be done for xterm.

But you should not need to use PROMPT_COMMAND to do this, it can be done
by just setting the prompt, search the web for something like: "bash
prompt xterm title"

  > Now the thing is that executing this in a normal terminal renders
  > nothing, as opposed to term. My guess would be that term is missing
  > the \033] escape sequence.

It's actually \033];STUFF\007.


Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#5255; Package emacs. (Mon, 07 Sep 2009 21:35:04 GMT) Full text and rfc822 format available.

Message #15 received at 5255 <at> debbugs.gnu.org (full text, mbox):

From: Fabian Ezequiel Gallina <galli.87 <at> gmail.com>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 5255 <at> debbugs.gnu.org
Subject: bug#5255: 23.1.90; Wrong prompt in term
Date: Tue, 22 Dec 2009 12:25:03 -0300
2009/12/22 Dan Nicolaescu <dann <at> ics.uci.edu>:
>  >
>  > I guess I found the problem:
>  >
>  > [fgallina <at> cuca lisp]$ env | grep PROMPT_COMMAND
>  > PROMPT_COMMAND=echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"
>
> That looks like a bad idea.
> I am guessing that you are trying to set the xterm title to display the
> current directory in the shell, this uses an xterm specific escape sequence.
> So it should only be done for xterm.
>

Yes, it is used just for that, I found this which explains the thing:
http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1

> But you should not need to use PROMPT_COMMAND to do this, it can be done
> by just setting the prompt, search the web for something like: "bash
> prompt xterm title"
>

I didn't set up it myself, I guess xterm sets this automatically.

>  > Now the thing is that executing this in a normal terminal renders
>  > nothing, as opposed to term. My guess would be that term is missing
>  > the \033] escape sequence.
>
> It's actually \033];STUFF\007.
>

Oh yes, actually that is not being taken into account and I guess it
should, at least that's what happens in emacs 23.1.


Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#5255; Package emacs. (Mon, 07 Sep 2009 21:35:04 GMT) Full text and rfc822 format available.

Message #18 received at 5255 <at> debbugs.gnu.org (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Fabian Ezequiel Gallina <galli.87 <at> gmail.com>
Cc: 5255 <at> debbugs.gnu.org
Subject: bug#5255: 23.1.90; Wrong prompt in term
Date: Tue, 22 Dec 2009 07:44:50 -0800 (PST)
Fabian Ezequiel Gallina <galli.87 <at> gmail.com> writes:

  > 2009/12/22 Dan Nicolaescu <dann <at> ics.uci.edu>:
  > >  >
  > >  > I guess I found the problem:
  > >  >
  > >  > [fgallina <at> cuca lisp]$ env | grep PROMPT_COMMAND
  > >  > PROMPT_COMMAND=echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"
  > >
  > > That looks like a bad idea.
  > > I am guessing that you are trying to set the xterm title to display the
  > > current directory in the shell, this uses an xterm specific escape sequence.
  > > So it should only be done for xterm.
  > >
  > 
  > Yes, it is used just for that, I found this which explains the thing:
  > http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1

The explanation is not very clear, it actually shows how this can be
done by using just PS1 and not PROMPT_COMMAND...
And it's shown that is should only happen when TERM is xterm.

  > > But you should not need to use PROMPT_COMMAND to do this, it can be done
  > > by just setting the prompt, search the web for something like: "bash
  > > prompt xterm title"
  > >
  > 
  > I didn't set up it myself, I guess xterm sets this automatically.

xterm does not do things like that.
Your system does it then, and it's wrong, it should only do it if TERM
is xterm.

  > 
  > >  > Now the thing is that executing this in a normal terminal renders
  > >  > nothing, as opposed to term. My guess would be that term is missing
  > >  > the \033] escape sequence.
  > >
  > > It's actually \033];STUFF\007.
  > >
  > 
  > Oh yes, actually that is not being taken into account and I guess it
  > should, at least that's what happens in emacs 23.1.

This is an xterm specific escape sequence, most likely due to a bad
setup, you'll get the same problem if you use a vt100 terminal for
example.  
So this is not a term.el problem.


Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#5255; Package emacs. (Mon, 07 Sep 2009 21:35:04 GMT) Full text and rfc822 format available.

Message #21 received at 5255 <at> debbugs.gnu.org (full text, mbox):

From: Fabian Ezequiel Gallina <galli.87 <at> gmail.com>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 5255 <at> debbugs.gnu.org
Subject: bug#5255: 23.1.90; Wrong prompt in term
Date: Mon, 28 Dec 2009 02:11:44 -0300
2009/12/22 Dan Nicolaescu <dann <at> ics.uci.edu>:
>
> This is an xterm specific escape sequence, most likely due to a bad
> setup, you'll get the same problem if you use a vt100 terminal for
> example.
> So this is not a term.el problem.
>

Thanks for the explanation, I just added this to my .bashrc and
everything started to work fine again:

if [[ $TERM =~ ^xterm ]];
then
	TERM=xterm-256color
	PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
else
	PROMPT_COMMAND=""
fi

However what really surprises me is that emacs 23.1 didn't got the
prompt wrong with my old PROMPT_COMMAND.


Regards,
-- 
Fabián E. Gallina
http://www.from-the-cloud.com


Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#5255; Package emacs. (Mon, 07 Sep 2009 21:35:04 GMT) Full text and rfc822 format available.

Message #24 received at 5255 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Fabian Ezequiel Gallina <galli.87 <at> gmail.com>
Cc: 5255 <at> debbugs.gnu.org
Subject: bug#5255: 23.1.90; Wrong prompt in term
Date: Tue, 29 Dec 2009 16:19:19 -0200
> However what really surprises me is that emacs 23.1 didn't got the
> prompt wrong with my old PROMPT_COMMAND.

Odd, indeed.  If you could try and investigate further to try and figue
out what caused the change, it would be helpful.


        Stefan


Merged 5255 5334. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 08 Jan 2010 19:38:02 GMT) Full text and rfc822 format available.

Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Wed, 13 Jan 2010 00:51:02 GMT) Full text and rfc822 format available.

Notification sent to Fabian Ezequiel Gallina <galli.87 <at> gmail.com>:
bug acknowledged by developer. (Wed, 13 Jan 2010 00:51:02 GMT) Full text and rfc822 format available.

Message #31 received at 5255-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 5255-done <at> debbugs.gnu.org
Subject: Re: Bug#5255
Date: Tue, 12 Jan 2010 19:50:02 -0500
This bug was closed recently, but unfortunately the close message was
lost from the Emacs bug database. I am therefore resending the close
message. Sorry for the duplicate mail. The original close message was

http://lists.gnu.org/archive/html/bug-gnu-emacs/2009-12/msg00689.html

    From: Dan Nicolaescu <dann <at> ics.uci.edu>
    Subject: Re: bug#5255: 23.1.90; Wrong prompt in term
    To: Fabian Ezequiel Gallina <galli.87 <at> gmail.com>
    Cc: 5255-done <at> debbugs.gnu.org
    Date: Mon, 28 Dec 2009 11:28:21 -0800 (PST)
    
    Fabian Ezequiel Gallina <galli.87 <at> gmail.com> writes:
    
      > 2009/12/22 Dan Nicolaescu <dann <at> ics.uci.edu>:
      > >
      > > This is an xterm specific escape sequence, most likely due to a bad
      > > setup, you'll get the same problem if you use a vt100 terminal for
      > > example.
      > > So this is not a term.el problem.
      > >
      > 
      > Thanks for the explanation, I just added this to my .bashrc and
      > everything started to work fine again:
    
    I am closing this bug, it's not a bug in term.el
    
      > if [[ $TERM =~ ^xterm ]];
      > then
      > 	TERM=xterm-256color
    
    Changing the value of TERM is a bad idea, unless you know exactly what
    you are doing.
    
      > 	PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
    
    Using PROMPT_COMMAND is not a good idea, the same thing can be done with
    just setting the prompt.
    ----------
    




Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Wed, 13 Jan 2010 00:51:02 GMT) Full text and rfc822 format available.

Notification sent to Scott Bell <sctb <at> me.com>:
bug acknowledged by developer. (Wed, 13 Jan 2010 00:51:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <bug-gnu-emacs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 10 Feb 2010 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 133 days ago.

Previous Next


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