2009-03-12, 06:47(-07), ipif: [...] > sh-3.2# bash > bash: command_substitute: cannot duplicate pipe as fd 1: Bad file descriptor > > (currently I'm using bash as init) [...] > In my opinion this problem might not be bash related, but I have no idea > what goes wrong. Unfortunately gdb seems to rely on some shell functions, so > I can't use it. > > No idea if this is helpfull: here is the end of strace's output: [...] > stat64("//.dir_colors", 0xefc665c0) = -1 ENOENT (No such file or > directory) > stat64("/etc/DIR_COLORS", {st_mode=S_IFREG|0644, st_size=4038, ...}) = 0 > pipe([3, 4]) = 3 > fork(bash: command_substitute: cannot duplicate pipe as fd 1: Bad file > descriptor > ) = 660 [...]
Looks like it is evaluating some code that something like does: if [ -e "$HOME/dircolors" ] || [ -e /etc/DIR_COLORS ]; then eval "$(dircolors)" fi It fails in the subshell when redirecting dircolors's output to the pipe which command substitution reads the other end of. As you didn't do strace -f, we don't see what's happening in the subshell, but it's likely to be the dup2(4, 1). The return value of pipe() is quite surprising there. pipe(2) is meant to return either 0 or -1, so it looks like a problem in your Linux kernel (or strace), possibly some mess up with the system call numbers? -- Stéphane