Download raw body.
wrong strip(1) parameters in lang/ruby
On 2025/06/22 12:32, Jeremy Evans wrote:
> On Sun, Jun 22, 2025 at 7:17 AM Stuart Henderson <stu@spacehopper.org> wrote:
>
> On 2025/06/22 14:51, Rafael Sadowski wrote:
> > On Sat Jun 14, 2025 at 12:53:21PM -0700, Jeremy Evans wrote:
> > > 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:
>
> It's a bit fiddly to fix properly, the script would need to determine
> which of the possible strip implementations the arch is using and reject
> the relevant flags for that arch.
>
> and it's rarely relevant because most of the time, the flags are used
> within the port build i.e. with the dummy script, so it doesn't matter.
>
> and then, it seems this shouldn't matter on archs which have debug
> packages for ruby? (because in those cases it would defer to the real
> strip).
>
> > > 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
> >
> > Looks like nobody wants to fix this in infrastructure. OK
> > rsadowski@ could you also commit it to -stable please?
>
> as long as these flags are correct for the strip on all archs with ruby,
> this is probably the simplest way to fix it.
>
>
> I committed the change for Ruby 3.2, 3.3, and 3.4. However, I think a way
> to fix it without patching the ports would be to have WRKDIR/bin/strip
> exec the actual strip command with all arguments during the configure
> stage. After the configure stage, it could have the current behavior of always
> returning true without making changes.
There are issues with that approach too, some ports run configure
scripts during the build rather than configure phase (sometimes
additional scripts for submodules or vendored deps, sometimes
a port uses multiple build systems and it's hard to wedge them
together via normal ports scaffolding, especially if one has to
be configured and built before the other is configured and built).
Even without that we'd either need to start passing the build stage
through somehow (maybe via the environment, but some people list only
specific variables in their doas or sudo config..), or change things
so that the no-strip script is replaced for different build stages
(bearing in mind that people may redo builds from various stages after
clearing flags in WRKDIR).
wrong strip(1) parameters in lang/ruby