Chmod in a File block

While looking at a CI failure on the rubyzip gem, I found that an error
was generated from a line like this:

File.open(“data/generated/empty_chmod640.txt”, “w”) { |f| f.chmod(0640)
}

The error was: “RuntimeError: No such file or directory -
data/generated/empty_chmod640.txt”

The error was consistent in the test suite, but I was not able to
reproduce it outside of the test suite. A simple change fixed the
problem:

Could this be a JRuby bug? Are there any known related issues?

Is it on Windows? I would think we create the file write away, but
Windows
is really unhappy doing 2 things to one file at the same time.

-Tom

Ahh, so that’s why it wasn’t working :slight_smile: I was running into that too.

It sounds like a JRuby bug but I don’t know why it would fail that way.

  • Charlie

No, Mac OS X and Ubuntu (happens on both). But i couldn’t reproduce it
in isolation. So it works in general.

Ok, I opened chmod inside of File block fails to create file · Issue #1149 · jruby/jruby · GitHub