bash: command_substitute: cannot duplicate pipe as fd 1: Bad file descriptor

2009-03-12 Thread ipif

Hi,

I'm currently trying to get Linux working on an embedded sparc processor
(leon3, sparc V8).  

But every time I try to run an instance of bash the following error occurs:
sh-3.2# bash
bash: command_substitute: cannot duplicate pipe as fd 1: Bad file descriptor

(currently I'm using bash as init)

This software is used:
bash-3.2_p39
gcc-4.2.1
uClibc-0.9.30
linux-2.6.21.1

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:
open("/etc/passwd", O_RDONLY)   = 3
ioctl(3, TCSETAF or SNDCTL_TMR_SELECT, 0xefc669c4) = -1 ENOTTY
(Inappropriate ioctl for device)
brk(0xcc000)= 0xcc000
read(3, "root:x:0:0:root:/root:/bin/bash\nb"..., 4096) = 704
close(3)= 0
stat64("/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat64(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
getpid()= 659
getppid()   = 658
ioctl(2, TCSETAF or SNDCTL_TMR_SELECT, {B38400 opost isig icanon echo ...})
= 0
brk(0xcd000)= 0xcd000
open("/etc/bash/bashrc", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=2550, ...}) = 0
read(3, "# /etc/bash/bashrc\n#\n# This file "..., 2550) = 2550
close(3)= 0
brk(0xce000)= 0xce000
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

Thank you for your help.
-jan

-- 
View this message in context: 
http://www.nabble.com/bash%3A-command_substitute%3A-cannot-duplicate-pipe-as-fd-1%3A-Bad-file-descriptor-tp22476700p22476700.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.





Re: bash: command_substitute: cannot duplicate pipe as fd 1: Bad file descriptor

2009-03-17 Thread ipif


Stephane Chazelas wrote:
> 
> 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
> [...]
> 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?
> [...]
> 

Thank you for pointing this out. Somehow the pipe system call was not
implemented for sparc in uclibc. I fixed that by porting it from glibc. 

-jan
-- 
View this message in context: 
http://www.nabble.com/bash%3A-command_substitute%3A-cannot-duplicate-pipe-as-fd-1%3A-Bad-file-descriptor-tp22476700p22555424.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.