From: anton.lindqvist@...
Date: 2016-12-26T10:00:05+00:00
Subject: [ruby-core:78844] [Ruby trunk Bug#13069] mkmf: ignore linker	warnings on OpenBSD

Issue #13069 has been updated by Anton Lindqvist.


Nobuyoshi Nakada wrote:
> Seems `sprintf` nor `vsprintf` are used on OpenBSD.
> Those warnings are always emitted regardless use of the functions?

Here's a minimal example causing the errors to be outputted while
dynamically linking against ruby:

~~~
$ env "PATH=${DESTDIR}/usr/local/bin:${PATH}" ruby -v
ruby 2.4.0dev (2016-12-24 trunk 57169) [x86_64-openbsd6.0]
$ cat test.c
#include "ruby.h"

int main(void) { return 0; }
$ cc \
    -o test  \
    -I ${DESTDIR}/usr/local/include/ruby-2.4.0/x86_64-openbsd6.0 \
    -I ${DESTDIR}/usr/local/include/ruby-2.4.0 \
    test.c \
    -L ${DESTDIR}/usr/local/lib \
    -lruby \
    -lm \
    -lpthread
usr/local/lib/libruby.so: warning: warning: strcpy() is almost always misused, please use strlcpy()
usr/local/lib/libruby.so: warning: warning: strcat() is almost always misused, please use strlcat()
~~~

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

* Author: Anton Lindqvist
* Status: Feedback
* 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>