Open vakuum opened 10 years ago
I'm still looking for a proper way to fix this, but for your use-case, a workaround would be to use a custom passphrase callback and call IO#close at the end:
def pass_function(pass, uid_hint, passphrase_info, prev_was_bad, fd)
io = IO.for_fd(fd, 'w')
io.puts 'password'
io.flush
io.close
end
crypto = GPGME::Crypto.new(armor: false, symmetric: true,
passphrase_callback: method(:pass_function))
However, I doubt that we can simply do that in our default callback, as other gpgme engines might assume the FD is never closed.
Closing the file handle in the passphrase callback solved the problem.
Thank you!
The following code always throws an Errno::EBADF exception after some loop iterations:
I tried it with Ruby 2.0.0p353 and Ruby 2.0.0p576 on Ubuntu 12.04.5 LTS and Ubuntu 14.04.1 LTS:
Installed packages under Ubuntu 12.04.5 LTS
Installed packages under Ubuntu 14.04.1 LTS