sayak-m / shcov

Automatically exported from code.google.com/p/shcov
GNU General Public License v2.0
0 stars 0 forks source link

echo: write error: Bad file descriptor #4

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

Please help me with the following issue.

What steps will reproduce the problem?
1.Install setup.py
2.Run any shell script from /shcov-5/tests/

What is the expected output? What do you see instead?
I'm seeing 
./second-tst.sh: line 7: echo: write error: Bad file descriptor
./second-tst.sh: line 4: echo: write error: Bad file descriptor

What version of the product are you using? On what operating system?
I'm using shcov-5 from download link. I'm using RedHat OS on a VM.

Thank You.

Original issue reported on code.google.com by chris.au...@gmail.com on 16 May 2011 at 9:23

GoogleCodeExporter commented 8 years ago
Well, second-tst.sh just uses /bin/sh as hash bang. Is /bin/sh bash on your 
system? shcov only works with bash.

Original comment by simon.ka...@gmail.com on 18 May 2011 at 6:43

GoogleCodeExporter commented 8 years ago
yes, I'm using bash shell. I have this error when I run the script with shcov 
command.

Thank you.

Original comment by chris.au...@gmail.com on 18 May 2011 at 4:46

GoogleCodeExporter commented 8 years ago
me,too

Original comment by 307230...@qq.com on 23 Sep 2011 at 6:32

GoogleCodeExporter commented 8 years ago
Me three. I think it's when the script under test redirects stdin/stdout and 
uses here documents.

Original comment by JohnSarg...@gmail.com on 1 Nov 2011 at 4:24

GoogleCodeExporter commented 8 years ago
I am getting the same issue.

Original comment by verma...@gmail.com on 12 Jan 2012 at 11:29

GoogleCodeExporter commented 8 years ago
Is anybody having solution for the above issue.or workaround...

Original comment by verma...@gmail.com on 12 Jan 2012 at 11:32

GoogleCodeExporter commented 8 years ago
i got the same error, it looks like, if the shell scripts contains any "echo" 
it throws " echo: write error: Bad file descriptor", without echo statement the 
coverager tool works fine, i wonder how they publish the code without any doing 
formal testing 

Original comment by anish2g...@gmail.com on 18 Jan 2012 at 8:50

GoogleCodeExporter commented 8 years ago
I still can't reproduce this on my system, so I'm guessing it's tied to some 
version of bash.

And as for "they" publishing the code: This is one of my hobby projects. I 
wrote it because it's a fun way to pass some time on an interesting problem, 
and published the source on the internet. I haven't done formal testing on 
multiple systems etc, simply because I have better/more fun things to do with 
my spare time.

Original comment by simon.ka...@gmail.com on 18 Jan 2012 at 11:03

GoogleCodeExporter commented 8 years ago
I get error on the following platform

Red Hat Enterprise Linux Server release 5.3
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

[root@btovm491 tests]# ./hash_bang.sh
./hash_bang.sh: line 3: echo: write error: Bad file descriptor
./hash_bang.sh: line 4: echo: write error: Bad file descriptor

Original comment by veerarag...@gmail.com on 18 Jan 2012 at 11:41

GoogleCodeExporter commented 8 years ago
to the owner, are this issue are going to fixed ?

Original comment by anish2g...@gmail.com on 20 Feb 2012 at 3:55

GoogleCodeExporter commented 8 years ago
Maybe. I don't work actively on shcov though, so I can't give any promises.

Original comment by simon.ka...@gmail.com on 20 Feb 2012 at 7:17

GoogleCodeExporter commented 8 years ago
Folks, I was able to remove this issue by modifying the following line in the 
'shcov' script:

From:
       self.process = subprocess.Popen( self.shell + self.args,  stdin = sys.stdin,                                         stdout = sys.stdout, stderr = subprocess.PIPE)

To:
        self.process = subprocess.Popen( self.shell + self.args,
                                         stderr = subprocess.PIPE)

Basically, removing the redirect for stdin and stdout (letting Python defaults 
take effect). Hope this helps someone!

@Simon - thanks, for a side project, this is awesome and definitely fills a 
need in the shell script dev community.

Original comment by pmular...@gmail.com on 11 Sep 2012 at 5:55

GoogleCodeExporter commented 8 years ago
Fixed in commit r71, thanks pmularien!

Thanks for the encouraging words, however I don't think I'll continue with 
shcov. Over the last two years or so, I've spent much more time on a code 
coverage tool for compiled code, kcov (http://simonkagstrom.github.com/kcov/), 
which is more useful for me and also more fun to work on :-)

Original comment by simon.ka...@gmail.com on 11 Sep 2012 at 7:17