Issue #13069 has been updated by Jeremy Evans.

Status changed from Feedback to Open

Some of the warnings were addressed in r57189, r57190, and r57191.  However, I think we should rethink checking for an empty log file, and rely purely on the return code:

~~~ diff
--- lib/mkmf.rb.orig    Sun Dec 25 09:49:06 2016
+++ lib/mkmf.rb Sun Dec 25 09:49:51 2016
@@ -388,7 +388,7 @@ module MakeMakefile
         result = nil
         Logging.postpone do |log|
           output = IO.popen(libpath_env, command, &:read)
-          result = ($?.success? and File.zero?(log.path))
+          result = $?.success?
           output
         end
         result
~~~

The only reason I can think of to not rely purely on the return code is if we want to support environments where the command would return 0 in the case where it failed.  Are there such environments?

The approach of the current code is similar to defaulting to `-Werror` when compiling C, which is almost always a bad idea when distributing C code unless you know every possible environment you want to support (which ruby does not).

----------------------------------------
Bug #13069: mkmf: ignore linker warnings on OpenBSD
https://bugs.ruby-lang.org/issues/13069#change-62325

* Author: Anton Lindqvist
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Installing gems with native extensions fails on my OpenBSD machine since
the linker emits warnings causing stderr to not be empty as expected.
The warnings are security recommendations that does not affect the
linked binary. See examples below from my mkmf.log caused by libruby:

~~~
warning: warning: strcpy() is almost always misused, please use strlcpy()
warning: warning: strcat() is almost always misused, please use strlcat()
warning: warning: sprintf() is often misused, please use snprintf()
warning: warning: vsprintf() is often misused, please use vsnprintf()
~~~

Attached is patch that checks the output for such harmless warnings. Not
sure if this exception should be allowed on all platforms, but instead
wrapped in a `RUBY_PLATFORM =~ /openbsd/` conditional or something
similar.

---Files--------------------------------
ruby-mkmf_openbsd.diff (880 Bytes)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>