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:
https://github.com/rubyzip/rubyzip/commit/b67675480d1c14d26a55aad080dcc8a44d86c5bc

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 https://github.com/jruby/jruby/issues/1149

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs