From: "Hanmac (Hans Mackowiak)" Date: 2022-05-09T14:21:38+00:00 Subject: [ruby-core:108494] [Ruby master Bug#18766] ArgumentError with no backtrace information when requiring openssl/cipher and initializing an OpenSSL::Cipher Issue #18766 has been updated by Hanmac (Hans Mackowiak). technically it does show, the problem are the parameter for initialize, or better for `BasicObject#initialize` The Error you get is this one: ``` irb(main):001:0> class X irb(main):002:0> end => nil irb(main):003:0> x= X.new("abe") (irb):3:in `initialize': wrong number of arguments (given 1, expected 0) (ArgumentError) from (irb):3:in `new' from (irb):3:in `
' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:11:in `' from C:/Ruby31-x64/bin/irb:33:in `load' from C:/Ruby31-x64/bin/irb:33:in `
' ``` because BasicObject#initialize doesn't want any Parameters now when you require `openssl/cipher` you get a Cipher class using the default ruby alloc with the `BasicObject#initialize` which of course is crashing when you give them any parameters ---------------------------------------- Bug #18766: ArgumentError with no backtrace information when requiring openssl/cipher and initializing an OpenSSL::Cipher https://bugs.ruby-lang.org/issues/18766#change-97539 * Author: postmodern (Hal Brodigan) * Status: Open * Priority: Normal * ruby -v: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- I discovered a mysterious ArgumentError when requiring 'openssl/cipher' instead of 'openssl' and initializing a OpenSSL::Cipher object. The ArgumentError does not indicate where the exception is being raised from. ## Steps To Reproduce ``` ruby -r openssl/cipher -e "p OpenSSL::Cipher.new('aes-256-cbc')" ``` ## Expected Result ``` # ``` ## Actual Result ``` Traceback (most recent call last): 2: from -e:1:in `
' 1: from -e:1:in `new' -e:1:in `initialize': wrong number of arguments (given 1, expected 0) (ArgumentError) ``` ## Effected Versions Can reproduce this bug using ruby-2.7 and ruby-3.1. -- https://bugs.ruby-lang.org/ Unsubscribe: