diff options
author | Bundlerbot <bot@bundler.io> | 2018-09-25 04:24:58 +0000 |
---|---|---|
committer | Colby Swandale <me@colby.fyi> | 2018-10-05 13:48:27 +1000 |
commit | fc4e0e3a08537dba6a971274519384f3ce78051d (patch) | |
tree | 0b940bd4b3f32e9984da02cc6e40d6e80c404103 | |
parent | 4629e9e70f54ed6ed090d017e2971fbcf7c0b340 (diff) | |
download | bundler-fc4e0e3a08537dba6a971274519384f3ce78051d.tar.gz |
Merge #6686
6686: Output OpenSSL information only when OpenSSL is available. r=segiddins a=voxik
It seems that only single OpenSSL availability check should be enough to output or not output the OpenSSL information.
I split this into two commits, so you can cherry-pick, in case you want to be more cautious about the availability of specific constants, but since they were introduced in Ruby 1.8.0 (https://github.com/ruby/ruby/commit/78ff3833fb67c8005a9b851037e7), I would not bother.
Please note that that this code was pointed out by Coverity scanner (although it is definitely not an error):
~~~
Error: FORWARD_NULL (CWE-476):
rubygem-bundler-1.16.1/usr/share/gems/gems/bundler-1.16.1/lib/bundler/env.rb:113: null_check: Calling "defined?(OpenSSL)" implies that "OpenSSL" might be null-like.
rubygem-bundler-1.16.1/usr/share/gems/gems/bundler-1.16.1/lib/bundler/env.rb:114: property_access: Accessing a property of null-like value "OpenSSL".
# 112| out << [" Bin Dir", Gem.bindir]
# 113| out << ["OpenSSL"] if defined?(OpenSSL)
# 114|-> out << [" Compiled", OpenSSL::OPENSSL_VERSION] if defined?(OpenSSL::OPENSSL_VERSION)
# 115| out << [" Loaded", OpenSSL::OPENSSL_LIBRARY_VERSION] if defined?(OpenSSL::OPENSSL_LIBRARY_VERSION)
# 116| out << [" Cert File", OpenSSL::X509::DEFAULT_CERT_FILE] if defined?(OpenSSL::X509::DEFAULT_CERT_FILE)
~~~
Co-authored-by: Vít Ondruch <vondruch@redhat.com>
(cherry picked from commit 0d7259e69951b5d6f99f4ddd082508d7ef38fce9)
-rw-r--r-- | lib/bundler/env.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/bundler/env.rb b/lib/bundler/env.rb index 171b6520ad..51738139fa 100644 --- a/lib/bundler/env.rb +++ b/lib/bundler/env.rb @@ -110,11 +110,13 @@ module Bundler out << [" Gem Path", ENV.fetch("GEM_PATH") { Gem.path.join(File::PATH_SEPARATOR) }] out << [" User Path", Gem.user_dir] out << [" Bin Dir", Gem.bindir] - out << ["OpenSSL"] if defined?(OpenSSL) - out << [" Compiled", OpenSSL::OPENSSL_VERSION] if defined?(OpenSSL::OPENSSL_VERSION) - out << [" Loaded", OpenSSL::OPENSSL_LIBRARY_VERSION] if defined?(OpenSSL::OPENSSL_LIBRARY_VERSION) - out << [" Cert File", OpenSSL::X509::DEFAULT_CERT_FILE] if defined?(OpenSSL::X509::DEFAULT_CERT_FILE) - out << [" Cert Dir", OpenSSL::X509::DEFAULT_CERT_DIR] if defined?(OpenSSL::X509::DEFAULT_CERT_DIR) + if defined?(OpenSSL) + out << ["OpenSSL"] + out << [" Compiled", OpenSSL::OPENSSL_VERSION] if defined?(OpenSSL::OPENSSL_VERSION) + out << [" Loaded", OpenSSL::OPENSSL_LIBRARY_VERSION] if defined?(OpenSSL::OPENSSL_LIBRARY_VERSION) + out << [" Cert File", OpenSSL::X509::DEFAULT_CERT_FILE] if defined?(OpenSSL::X509::DEFAULT_CERT_FILE) + out << [" Cert Dir", OpenSSL::X509::DEFAULT_CERT_DIR] if defined?(OpenSSL::X509::DEFAULT_CERT_DIR) + end out << ["Tools"] out << [" Git", git_version] out << [" RVM", ENV.fetch("rvm_version") { version_of("rvm") }] |