$HOME does not get abbreviated in prompt \w output when there is a trailing slash

2014-05-16 Thread Libor Pechacek
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc -I/home/abuild/rpmbuild/BUILD/bash-4.2 
-L/home/abuild/rpmbuild/BUILD/bash-4.2/../readline-6.2
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-suse-linux-gnu' 
-DCONF_VENDOR='suse' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -fmessage-length=0 
-grecord-gcc-switches -fstack-protector -O2 -Wall -D_FORTIFY_SOURCE=2 
-funwind-tables -fasynchronous-unwind-tables -g  -D_GNU_SOURCE -DRECYCLES_PIDS 
-Wall -g -std=gnu89 -Wuninitialized -Wextra -Wno-unprototyped-calls 
-Wno-switch-enum -Wno-unused-variable -Wno-unused-parameter -ftree-loop-linear 
-pipe -DBNC382214=0 -fprofile-use
uname output: Linux fmn.suse.cz 3.12.18-4-default #1 SMP Thu May 8 16:21:49 UTC 
2014 (607beab) x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-suse-linux-gnu

Bash Version: 4.2
Patch Level: 46
Release Status: release

Description:
Bash prompt always shows full path in prompt instead of tilde
abbreviation when $HOME ends with slash.

Repeat-By:
lpechacek@fmn:~> PS1='\w\$ '
~$ HOME=/home/lpechacek/
/home/lpechacek$ HOME=/home/lpechacek
~$  # the above line should start with '~$ '



Re: $HOME does not get abbreviated in prompt \w output when there is a trailing slash

2014-05-16 Thread Chet Ramey
On 5/16/14, 5:22 AM, Libor Pechacek wrote:

> Bash Version: 4.2
> Patch Level: 46
> Release Status: release
> 
> Description:
>   Bash prompt always shows full path in prompt instead of tilde
>   abbreviation when $HOME ends with slash.

This came up in March, 2012:

http://lists.gnu.org/archive/html/bug-bash/2012-03/msg00055.html

My opinion that this is not a bug in bash hasn't changed.  There are a
number of easy ways to remove this trailing slash.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: $HOME does not get abbreviated in prompt \w output when there is a trailing slash

2014-05-16 Thread Libor Pechacek
Hi Chet,

On Fri 16-05-14 09:13:34, Chet Ramey wrote:
> On 5/16/14, 5:22 AM, Libor Pechacek wrote:
> 
> > Bash Version: 4.2
> > Patch Level: 46
> > Release Status: release
> > 
> > Description:
> > Bash prompt always shows full path in prompt instead of tilde
> > abbreviation when $HOME ends with slash.
> 
> This came up in March, 2012:
> 
> http://lists.gnu.org/archive/html/bug-bash/2012-03/msg00055.html
> 
> My opinion that this is not a bug in bash hasn't changed.  There are a
> number of easy ways to remove this trailing slash.

Agree.  On the other hand, passwd(5) does not fobid the trailing slash.  That
said I think that either bash should tolerate the trailing slash - will likely
be easy as you mentioned above - or the limitation should be documented in bash
manual so that no more people burn their time on this unexpected behavior.

Libor
-- 
Libor Pechacek
Project Manager SUSE Labs, Prague



Bug when trapping exit from subshell

2014-05-16 Thread Mark Ferrell
The following script properly reports the exit code to the calling
environment, , but the exit handler is not called if a function
triggers the exit vs an external command.

Script executed via:
bash 

Re: Bug when trapping exit from subshell

2014-05-16 Thread Maarten Billemont
the exit handler is called, you just muted it.  remove the redirections,
and you'll also notice you need a space after your !


On 16 May 2014 12:41, Mark Ferrell  wrote:

> The following script properly reports the exit code to the calling
> environment, , but the exit handler is not called if a function
> triggers the exit vs an external command.
>
> Script executed via:
> bash