[PATCH] ash fancy prompt expansion

Denys Vlasenko vda.linux at googlemail.com
Fri Sep 21 18:51:23 UTC 2007


On Friday 21 September 2007 08:30, Natanael Copa wrote:
> (I forgot to CC th emailint list so I resend this one)
> 
> On Sat, 2007-09-15 at 14:28 +0100, Denis Vlasenko wrote:
> > On Thursday 13 September 2007 12:39, Natanael Copa wrote:
> > > Hi,
> > > 
> > > Attatched is a patch that fixes the annoying bug in ash prmpt expansion.
> > > 
> > > Currently the default PS1='\w \$ ' will always show a '$' as prompt
> > > while PS1='\w \\$ ' will show a '#' if effective user is root and '$'
> > > otherwise.
> > 
> > This is strange, for me current svn seems to work:
> > 
> > sh-3.2# ./busybox ash
> > /.1/usr/srcdevel/bbox/fix/busybox.t3 # PS1='\w \$ '
> > /.1/usr/srcdevel/bbox/fix/busybox.t3 # PS1='\w \\$ '
> > /.1/usr/srcdevel/bbox/fix/busybox.t3 \$ PS1='TEST>\$ '
> > TEST># PS1='TEST>\\$ '
> > TEST>\$
> > 
> > Is it already fixed? Or maybe it depends on .config.
> > Mine is attached.
> 
> > CONFIG_ASH_RANDOM_SUPPORT=y
> > # CONFIG_ASH_EXPAND_PRMT is not set
> > CONFIG_HUSH=y 
> 
> Try enable CONFIG_ASH_EXPAND_PRMT
> 
> Maybe we should check if ASH_EXPAND_PRMT is enabled before trying to fix
> the prompt expansion. See attatched patch.

With this patch I get this:

$ env - ./busybox ash
w $ set
IFS='
'
OPTIND='1'
PATH='/sbin:/usr/sbin:/bin:/usr/bin'
PPID='12606'
PS1='\w \$ '
PS2='> '
PS4='+ '
PWD='/usr/local/google/vda/srcdev/bbox/fix/busybox.t5'
w $

Looks like it got worse, not better...
I am attaching my .config too.

(I edited ash.c in svn. I rediffed your patch, see attached).
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 5.patch
Type: text/x-diff
Size: 1769 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070921/5c9c518c/attachment-0004.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.bz2
Type: application/x-bzip2
Size: 4069 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070921/5c9c518c/attachment-0005.bin 


More information about the busybox mailing list