bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: shouldn't prompt printing be smarter?


From: Francesco Montorsi
Subject: Re: shouldn't prompt printing be smarter?
Date: Sun, 01 Apr 2007 23:15:17 +0200
User-agent: Mozilla Thunderbird 1.5.0.10 (X11/20070306)

Hi,

Bob Proulx ha scritto:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;address@hidden:\[\033[01;34m\]\w\[\033[00m\]\$ '
what is it btw?

That is a pretty standard Debian setting that looks to see if you are
running inside of a chroot.  Normally inside of a chroot on Debian
systems the file /etc/debian_chroot has been set (I wish it were a
more generic name) to the name of the chroot.  That is used to set the
debian_chroot variable.  The variable setting is used in the prompt
itself.  You have the color prompt setting uncommented which is pretty
gnarly.  The non-color one is easier to understand.

  PS1='${debian_chroot:+($debian_chroot)address@hidden:\w\$ '

It simply places the value of the variable if it is set in the prompt
inside parenthesis.  If it is not set then it reduces simply to the
basic 'address@hidden:\w\$ '.
thanks for the explanation!


There are two separate issues.
right

 One is that you think that the shell
should be able to dynamically determine the cursor location and add a
newline if it is not already in the first column.  I disagree.  The
shell should not do that.
why?
why would you ever want to have the prompt printed at non-zero column of the terminal?

If you want the shell to always add an
extra newline then you can always add one to your PS1 setting.  Some
people do that and like that configuration.
unfortunately in that way I suppose the terminal would then show:

address@hidden:~$ echo hello world
hello world

address@hidden:~$ bash --version
GNU bash, version 3.1.17(1)-release (i486-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

address@hidden:~$ cd ..

and so on. I.e. an empty line would _always_ be added :(

I think that printing the prompt where the user _always_ expect to have it is very important. Current behaviour could be considered a UI bug. Or otherwise it could be considered a "bug" those programs which don't print the final newline. In any case I really think that having the prompt printed in the _wrong_ place (i.e. in the wrong place from the user's POV) is indeed a usability bug.

To make everyone happy an option could be added to define the wanted behaviour.


Second is that you think there should only be one prompt printed in
that case. I agree.
me too

But I cannot recreate your behavior here and I
cannot think of how that would come about.  I am afraid you will have
to try to debug it further on your end.
I think I've restricted the possible sources of the problem. I've grabbed bash 3.2 tarball and compiled it. The problem does not appear there. It only appears with:

GNU bash, version 3.1.17(1)-release (i486-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

I've also found that Ubuntu guys made some diff to vanilla bash 3.1:
http://archive.ubuntu.com/ubuntu/pool/main/b/bash/bash_3.1-5ubuntu3.diff.gz

I've scanned it but couldn't see anything related, though...

Should I submit a bug to Ubuntu package or someone on the list has bash 3.1 and can look if is able to reproduce the problem?

I may also decide to upgrade my distro to the new beta Ubuntu Feisty (which has bash 3.2 to see if the bug was fixed there...)

Thanks,
Francesco





reply via email to

[Prev in Thread] Current Thread [Next in Thread]