Article View: gnu.bash.bug
Article #659bug with long prompt strings containing newlines
From: James J Dempsey
Date: Sat, 07 Oct 1989 16:45
Date: Sat, 07 Oct 1989 16:45
34 lines
1631 bytes
1631 bytes
[ bash 1.03, Sparcstation-1, SunOS 4.0.3c, gcc 1.35, yacc ] I like to know what my current directory is all the time. When I'm using X (which is usually) I have a PROMPT_COMMAND which puts the current directory (and hostname) in the title bar of the xterm window. However, when I'm dialing in from home, I set my PS1 to something like this: export PS1="\w \t\n\h $ " which ends up printing a prompt something like this: /usr/jjd 12:35:13 underdog % which is fine except when the current directory gets too long. Whenever bash tries to do editing, it gets confused about the length of the prompt. It thinks that the prompt is the length of the string PS1 without taking into account the \n characters. It should consider the length of the prompt to be the number of characters (after expansion) after the last \n. To reproduce this bug try this: PS1='012345678900123456789001234567890012345678900123456789001234567890\n$ ' (that's sixty characters followed by a newline, a dollarsign and a space) Then at the prompt type abcdefghijklmnopqrstuvwxyz followed by a ^A. When bash tries to reposition the cursor following the ^A command, it will get confused because it thinks the prompt is 63 characters instead of two. --Jim--
Technical Details
Message-ID:
<8910071652.AA01900@life.ai.mit.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!iuvax!purdue!tut.cis.ohio-state.edu!ALEXANDER.BBN.COM!jjdShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!iuvax!purdue!tut.cis.ohio-state.edu!ALEXANDER.BBN.COM!jjd From: jjd@ALEXANDER.BBN.COM (James J Dempsey) Newsgroups: gnu.bash.bug Subject: bug with long prompt strings containing newlines Message-ID: <8910071652.AA01900@life.ai.mit.edu> Date: 7 Oct 89 16:45:33 GMT Distribution: gnu Organization: GNUs Not Usenet Lines: 34