[PATCH] bash-4.0.10: segfault with `; &' at the end of case statement

2009-03-13 Thread Clark J. Wang
With bash version: 4.0.10, the following case statement crashed with segfault: $ cat foo.sh case a in a) echo a ;& esac $ bash4 foo.sh a Segmentation fault $ In an interactive shell, that case statement causes current shell to hang with nearly 100% CPU usage. The following patch fixes this f

Re: Problem with returning to bash from another program

2009-03-13 Thread Chet Ramey
Cameron Pulsford wrote: > I am running bash 4.0.10 (installed through macports) > hw = Macbook 2,1 os = mac os x 10.5.6 > Compiled with gcc 4.0.1 > > A lot of times after a long vim session when I return to bash, my cursor > is not on a new line, it's on a previous line and it seems like bash is >

Re: new-style command substitution generates syntax error near ')'

2009-03-13 Thread Chet Ramey
esum...@ualberta.ca wrote: > Machine Type: amd64-portbld-freebsd7.1 > > Bash Version: 4.0 > Patch Level: 10 > Release Status: release > > Description: > Bash reports syntax error near unexpected token `)' for > new-style command substitution syntax, i.e., $(command) > in interactive an

Re: Install Bashdb and Bash not as root

2009-03-13 Thread Matthew Woehlke
lehe wrote: 1. The change to PATH is effective only in the current shell session. I was wondering if it is possible to run the new bash instead of the old one everytime it is lauched in terminal, putty and in emacs. Is there a place where the change to PATH could be added and executed before bash

Re: EOF disowns background jobs?

2009-03-13 Thread Matthew Woehlke
Chet Ramey wrote: Sven Mascheck wrote: I'd expect real daemons to detach from the terminal and create a new session / new process group. Or is it, that just too few actually do? Let's just say the situation is much better than it was in the past. Sven: I should point out that a more practic

Re: Creating directories with sticky bit set

2009-03-13 Thread Greg Wooledge
On Fri, Mar 13, 2009 at 11:40:58AM -0400, Dave Rutherford wrote: > --- building > $ gcc -fPIC -c -Wall sticky.c -o sticky.o > $ gcc -shared sticky.o -ldl -lstdc++ -o sticky.so > --- running > $ export LD_PRELOAD=$PWD/sticky.so:$LD_PRELOAD > --- for long-term use, add to bash startup files > > How

Re: Creating directories with sticky bit set

2009-03-13 Thread Dave Rutherford
On Fri, Mar 13, 2009 at 9:30 AM, Greg Wooledge wrote: > This still doesn't address the original poster's concerns if, for > example, a web browser creates a new ~/.browserconf directory the first > time it's invoked. But nothing bash can do will solve that. True, but what about a wrapper? --- s

Re: Creating directories with sticky bit set

2009-03-13 Thread Greg Wooledge
On Thu, Mar 12, 2009 at 07:40:58PM -0700, Ian Kelling wrote: > mkdir also has the -m argument, so you could do > mkdir -m 1755 dir Ah, clever. Then: mkdir() { command mkdir -m $(printf '%o\n' $((01777 - $(umask "$@" } This still doesn't address the original poster's concerns if, for examp

Re: Bash-4 breaks $() syntax on FreeBSD

2009-03-13 Thread Greg Wooledge
On Thu, Mar 12, 2009 at 05:05:33PM -0400, Gerard wrote: > #!/usr/bin/env bash > > if $(which gpg2); then >printf "gpg2 located" > fi The behavior of which(1) is not reliable across platforms. Since you're already using bash, you should consider using one of the bash builtins instead: if c

Re: new redirection operator seems broken

2009-03-13 Thread Pierre Gaston
On Thu, Mar 12, 2009 at 10:13 PM, Chet Ramey wrote: > I wonder if I should modify it so the implicit 2>&1 happens first, right > after the pipe, so any user-specified redirections can override it.  That > doesn't seem that radical a change.  Opinions?  (I know what you think, > Andreas ;-) ). If