Index | Thread | Search

From:
Jeremy Evans <jeremyevans0@gmail.com>
Subject:
Re: wrong strip(1) parameters in lang/ruby
To:
Rafael Sadowski <rafael@sizeofvoid.org>
Cc:
ports@openbsd.org
Date:
Sat, 14 Jun 2025 12:53:21 -0700

Download raw body.

Thread
On Sat, Jun 14, 2025 at 2:08 AM Rafael Sadowski <rafael@sizeofvoid.org>
wrote:

> I don't understand why our ruby determines "-A -n" when it should be
> "-S -x". This leads to issues when you building custom gems.
>
> # irb test case:
> irb(main):002> RbConfig::CONFIG['STRIP']
> => "strip -A -n"
>
> I don't really see anything wrong here. "if "${STRIP}" -A -n
> conftest$ac_exeext 2>/dev/null" should test with an error but it
> probably doesn't.
>

This is due to the ports infrastructure.  When building ports, it adds
WRKDIR/bin to PATH, and creates WRKDIR/bin/strip with the following content:

#! /bin/sh
# $OpenBSD: no-strip,v 1.1 2020/05/20 12:57:10 espie Exp $

echo "NOT running strip $@"

This returns 0 regardless of the options given, which is why Ruby thinks -A
-n are valid strip options.  This seems like a bug in the ports
infrastructure, not in Ruby.  It is fairly easy to work around:

Index: patches/patch-configure
===================================================================
RCS file: /cvs/ports/lang/ruby/3.4/patches/patch-configure,v
diff -u -p -u -p -r1.2 patch-configure
--- patches/patch-configure     11 Jan 2025 10:44:38 -0000      1.2
+++ patches/patch-configure     14 Jun 2025 19:45:35 -0000
@@ -17,6 +17,15 @@ Index: configure
  do :

                  # Try these flags in the _prepended_ position - i.e. we
want to try building a program
+@@ -31731,7 +31731,7 @@ main (void)
+ _ACEOF
+ if ac_fn_c_try_link "$LINENO"
+ then :
+-  if "${STRIP}" -A -n conftest$ac_exeext 2>/dev/null
++  if false # "${STRIP}" -A -n conftest$ac_exeext 2>/dev/null
+ then :
+
+             { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: -A -n"
>&5
 @@ -32280,7 +32280,7 @@ fi
         ;; #(
    openbsd*|mirbsd*) :

Let me know if I should commit that (with similar changes for Ruby 3.2 and
3.3), or if the ports infrastructure should be fixed.

Apologies if the diff doesn't apply due to gmail mangling.

Thanks,
Jeremy