Broken pipe (Errno::EPIPE)

Hi,

A little strange situation:

I have a ruby app which renames a bunch of files using File.rename. When I
run it in debug mode (with “-r debug”) and steps through it it works
without problems but when I run it normally or when packed up as an exe
with exerb I get

script.rb:778:in `rename’: Broken pipe - “file.ext” (Errno::EPIPE)

after a couple of files have been renamed.

Anyone knows what can cause this behavior?

This is with mingw32 Ruby 1.8 on cygwin:

$ ruby -v
ruby 1.8.0 (2003-01-27) [i386-mingw32]

Regards,

Robert Feldt

Hi, Robert. Can you supply the full script?

Thanks,
Chad

···

On Fri, 31 Jan 2003, Robert Feldt wrote:

Hi,

A little strange situation:

I have a ruby app which renames a bunch of files using File.rename. When I
run it in debug mode (with “-r debug”) and steps through it it works
without problems but when I run it normally or when packed up as an exe
with exerb I get

script.rb:778:in `rename’: Broken pipe - “file.ext” (Errno::EPIPE)

after a couple of files have been renamed.

Anyone knows what can cause this behavior?

This is with mingw32 Ruby 1.8 on cygwin:

$ ruby -v
ruby 1.8.0 (2003-01-27) [i386-mingw32]

Regards,

Robert Feldt

I’m not seeing anything in Ruby that would cause this. rb_file_s_rename
doesn’t provide many opportunities taht I can see. I wonder if this could
be a problem with mingw32/cygwin. Any other special characteristics of
this program? Multithreaded, etc?

Chad

···

On Fri, 31 Jan 2003, Robert Feldt wrote:

Hi,

A little strange situation:

I have a ruby app which renames a bunch of files using File.rename. When I
run it in debug mode (with “-r debug”) and steps through it it works
without problems but when I run it normally or when packed up as an exe
with exerb I get

script.rb:778:in `rename’: Broken pipe - “file.ext” (Errno::EPIPE)

after a couple of files have been renamed.

Anyone knows what can cause this behavior?

Sorry, its more of an app than a script so it is too large to enclose.
I understand its hard to debug without more info but any ideas where I can
start looking?

Regards,

Robert

···

On Fri, 31 Jan 2003, Chad Fowler wrote:

Hi, Robert. Can you supply the full script?

Sorry I never answered to this one Chad. I found the bug so forgot about
this. Problem was I tried to rename files for which there were unclosed
file handles. I figured that was the problem but thought I had thouroughly
ensured that there couldn’t be any open handles left. I was mistaken. :wink:

Anyway thanks for trying to help,

Robert

···

On Sat, 1 Feb 2003, Chad Fowler wrote:

I have a ruby app which renames a bunch of files using File.rename. When I
run it in debug mode (with “-r debug”) and steps through it it works
without problems but when I run it normally or when packed up as an exe
with exerb I get

script.rb:778:in `rename’: Broken pipe - “file.ext” (Errno::EPIPE)

after a couple of files have been renamed.

Anyone knows what can cause this behavior?

I’m not seeing anything in Ruby that would cause this. rb_file_s_rename
doesn’t provide many opportunities taht I can see. I wonder if this could
be a problem with mingw32/cygwin. Any other special characteristics of
this program? Multithreaded, etc?

Robert Feldt wrote:

···

On Sat, 1 Feb 2003, Chad Fowler wrote:

I have a ruby app which renames a bunch of files using File.rename. When I
run it in debug mode (with “-r debug”) and steps through it it works
without problems but when I run it normally or when packed up as an exe
with exerb I get

script.rb:778:in `rename’: Broken pipe - “file.ext” (Errno::EPIPE)

after a couple of files have been renamed.

Anyone knows what can cause this behavior?

I’m not seeing anything in Ruby that would cause this. rb_file_s_rename
doesn’t provide many opportunities taht I can see. I wonder if this could
be a problem with mingw32/cygwin. Any other special characteristics of
this program? Multithreaded, etc?

Sorry I never answered to this one Chad. I found the bug so forgot about
this. Problem was I tried to rename files for which there were unclosed
file handles. I figured that was the problem but thought I had thouroughly
ensured that there couldn’t be any open handles left. I was mistaken. :wink:

Anyway thanks for trying to help,

Robert

Thanks, Robert. No problem. I wonder if this is a situation where we
could have a more descriptive error message.

Thoughts everyone?

Chad

Hi,

···

At Wed, 12 Feb 2003 00:51:43 +0900, Chad Fowler wrote:

Thanks, Robert. No problem. I wonder if this is a situation where we
could have a more descriptive error message.

It’s a wrong error message, rather than a less descriptive one.
Necessary to map the error code from Windows-style value to
UNIX-like errno value, but nothing done in rb_w32_rename().


Nobu Nakada