Skip to content

Conversation

@fauno
Copy link

@fauno fauno commented Sep 20, 2019

Description:

Detect libc version on Linux, makes it possible to distinguish between distributions compiled with alternative libc

Tasks:

  • Describe the problem / feature
  • Write tests
  • Write code to solve the problem
  • Get code review from coworkers / friends

I will abide by the code of conduct.

@welcome
Copy link

welcome bot commented Sep 20, 2019

Thanks for opening a pull request and helping make RubyGems better! Someone from the RubyGems team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality.

We use Travis CI to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of Travis CI in the PR status window below.

If you have any questions or concerns that you wish to ask, feel free to leave a comment in this PR or join our #rubygems channel on Slack.

For more information about contributing to the RubyGems project feel free to review our CONTRIBUTING guide

@hsbt
Copy link
Member

hsbt commented Sep 24, 2019

@bundlerbot r+

ghost pushed a commit that referenced this pull request Sep 24, 2019
2922: Detect libc version, closes #2918 r=hsbt a=fauno

# Description:

Detect libc version on Linux, makes it possible to distinguish between distributions compiled with alternative libc

# Tasks:

- [ ] Describe the problem / feature
- [x] Write tests
- [ ] Write code to solve the problem
- [ ] Get code review from coworkers / friends

I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md).


Co-authored-by: f <f@sutty.nl>
@ghost
Copy link

ghost commented Sep 24, 2019

Build failed

@deivid-rodriguez
Copy link
Contributor

@bundlerbot retry

ghost pushed a commit that referenced this pull request Sep 25, 2019
2922: Detect libc version, closes #2918 r=hsbt a=fauno

# Description:

Detect libc version on Linux, makes it possible to distinguish between distributions compiled with alternative libc

# Tasks:

- [ ] Describe the problem / feature
- [x] Write tests
- [ ] Write code to solve the problem
- [ ] Get code review from coworkers / friends

I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md).


Co-authored-by: f <f@sutty.nl>
@ghost
Copy link

ghost commented Sep 25, 2019

Build succeeded

@ghost ghost merged commit 8a7e273 into ruby:master Sep 25, 2019
Sharpie added a commit to Sharpie/puppet-runtime that referenced this pull request Mar 1, 2020
This patch updates the cross-compiled Ruby build for armhf to
explicitly set the `--target` flag during configuration. This
prevents Ruby's configure script from stripping the `gnu`
suffix from the triplet, which in turn prevents RubyGems from
"loosing" gems with compile extensions installed prior to an
upgrade to RubyGems 3.1.0 or newer.

Ref. ruby/rubygems#2922
Ref. ruby/ruby@5291197
Sharpie added a commit to Sharpie/puppet-runtime that referenced this pull request May 25, 2020
This patch updates the cross-compiled Ruby build for armhf to
explicitly set the `--target` flag during configuration. This
prevents Ruby's configure script from stripping the `gnu`
suffix from the triplet, which in turn prevents RubyGems from
"loosing" gems with compile extensions installed prior to an
upgrade to RubyGems 3.1.0 or newer.

Ref. ruby/rubygems#2922
Ref. ruby/ruby@5291197
Sharpie added a commit to Sharpie/puppet-runtime that referenced this pull request May 25, 2020
This patch updates the cross-compiled Ruby build for armhf to
explicitly set the `--target` flag during configuration. This
prevents Ruby's configure script from stripping the `gnu`
suffix from the triplet, which in turn prevents RubyGems from
"loosing" gems with compile extensions installed prior to an
upgrade to RubyGems 3.1.0 or newer.

Ref. ruby/rubygems#2922
Ref. ruby/ruby@5291197
Sharpie added a commit to Sharpie/puppet-runtime that referenced this pull request May 25, 2020
This patch updates the cross-compiled Ruby build for armhf to
explicitly set the `--target` flag during configuration. This
prevents Ruby's configure script from stripping the `gnu`
suffix from the triplet, which in turn prevents RubyGems from
"loosing" gems with compile extensions installed prior to an
upgrade to RubyGems 3.1.0 or newer.

Ref. ruby/rubygems#2922
Ref. ruby/ruby@5291197
Sharpie added a commit to Sharpie/puppet-runtime that referenced this pull request Jul 21, 2020
This patch updates the cross-compiled Ruby build for armhf to
explicitly set the `--target` flag during configuration. This
prevents Ruby's configure script from stripping the `gnu`
suffix from the triplet, which in turn prevents RubyGems from
"loosing" gems with compile extensions installed prior to an
upgrade to RubyGems 3.1.0 or newer.

Ref. ruby/rubygems#2922
Ref. ruby/ruby@5291197
Sharpie added a commit to Sharpie/puppet-runtime that referenced this pull request Jul 23, 2020
This patch updates the cross-compiled Ruby build for armhf to
explicitly set the `--target` flag during configuration. This
prevents Ruby's configure script from stripping the `gnu`
suffix from the triplet, which in turn prevents RubyGems from
"loosing" gems with compile extensions installed prior to an
upgrade to RubyGems 3.1.0 or newer.

Ref. ruby/rubygems#2922
Ref. ruby/ruby@5291197
Sharpie added a commit to Sharpie/puppet-runtime that referenced this pull request Jul 31, 2020
This commit updates the settings and components related to ruby-2.5.8
to allow it to be cross-compiled when the use_pl_build_tools setting
is set to `false` for a platform.

The DTrace bindings for Ruby are also universally skipped if the plaform
is being cross-compiled.

The setup currently assumes that the cross-compiled ruby will be used
by the build machine to install gems and run scripts. I.e. Linux binfmt
will be configured to run the foreign binaries under QEMU emulation.

This patch also updates the cross-compiled Ruby build to
explicitly set the `--target` flag during configuration. This
prevents Ruby's configure script from stripping the `gnu`
suffix from the triplet, which in turn prevents RubyGems from
"loosing" gems with compile extensions installed prior to an
upgrade to RubyGems 3.1.0 or newer.

Ref. ruby/rubygems#2922
Ref. ruby/ruby@5291197
Sharpie added a commit to Sharpie/puppet-runtime that referenced this pull request Jul 31, 2020
This commit updates the settings and components related to ruby-2.5.8
to allow it to be cross-compiled when the use_pl_build_tools setting
is set to `false` for a platform.

The DTrace bindings for Ruby are also universally skipped if the plaform
is being cross-compiled.

The setup currently assumes that the cross-compiled ruby will be used
by the build machine to install gems and run scripts. I.e. Linux binfmt
will be configured to run the foreign binaries under QEMU emulation.

This patch also updates the cross-compiled Ruby build to
explicitly set the `--target` flag during configuration. This
prevents Ruby's configure script from stripping the `gnu`
suffix from the triplet, which in turn prevents RubyGems from
"loosing" gems with compile extensions installed prior to an
upgrade to RubyGems 3.1.0 or newer.

Ref. ruby/rubygems#2922
Ref. ruby/ruby@5291197
Sharpie added a commit to Sharpie/puppet-runtime that referenced this pull request Jul 31, 2020
This commit updates the settings and components related to ruby-2.5.8
to allow it to be cross-compiled when the use_pl_build_tools setting
is set to `false` for a platform.

The DTrace bindings for Ruby are also universally skipped if the plaform
is being cross-compiled.

The setup currently assumes that the cross-compiled ruby will be used
by the build machine to install gems and run scripts. I.e. Linux binfmt
will be configured to run the foreign binaries under QEMU emulation.

This patch also updates the cross-compiled Ruby build to
explicitly set the `--target` flag during configuration. This
prevents Ruby's configure script from stripping the `gnu`
suffix from the triplet, which in turn prevents RubyGems from
"loosing" gems with compile extensions installed prior to an
upgrade to RubyGems 3.1.0 or newer.

Ref. ruby/rubygems#2922
Ref. ruby/ruby@5291197
Sharpie added a commit to Sharpie/puppet-runtime that referenced this pull request Jul 31, 2020
This commit updates the settings and components related to ruby-2.5.8
to allow it to be cross-compiled when the use_pl_build_tools setting
is set to `false` for a platform.

The DTrace bindings for Ruby are also universally skipped if the plaform
is being cross-compiled.

The setup currently assumes that the cross-compiled ruby will be used
by the build machine to install gems and run scripts. I.e. Linux binfmt
will be configured to run the foreign binaries under QEMU emulation.

This patch also updates the cross-compiled Ruby build to
explicitly set the `--target` flag during configuration. This
prevents Ruby's configure script from stripping the `gnu`
suffix from the triplet, which in turn prevents RubyGems from
"loosing" gems with compile extensions installed prior to an
upgrade to RubyGems 3.1.0 or newer.

Ref. ruby/rubygems#2922
Ref. ruby/ruby@5291197
Sharpie added a commit to Sharpie/puppet-runtime that referenced this pull request Aug 1, 2020
This commit updates the settings and components related to ruby-2.5.8
to allow it to be cross-compiled when the use_pl_build_tools setting
is set to `false` for a platform.

The DTrace bindings for Ruby are also universally skipped if the plaform
is being cross-compiled.

The setup currently assumes that the cross-compiled ruby will be used
by the build machine to install gems and run scripts. I.e. Linux binfmt
will be configured to run the foreign binaries under QEMU emulation.

This patch also updates the cross-compiled Ruby build to
explicitly set the `--target` flag during configuration. This
prevents Ruby's configure script from stripping the `gnu`
suffix from the triplet, which in turn prevents RubyGems from
"loosing" gems with compile extensions installed prior to an
upgrade to RubyGems 3.1.0 or newer.

Ref. ruby/rubygems#2922
Ref. ruby/ruby@5291197
Sharpie added a commit to Sharpie/puppet-runtime that referenced this pull request Aug 1, 2020
This commit updates the settings and components related to ruby-2.5.8
to allow it to be cross-compiled when the use_pl_build_tools setting
is set to `false` for a platform.

The DTrace bindings for Ruby are also universally skipped if the plaform
is being cross-compiled.

The setup currently assumes that the cross-compiled ruby will be used
by the build machine to install gems and run scripts. I.e. Linux binfmt
will be configured to run the foreign binaries under QEMU emulation.

This patch also updates the cross-compiled Ruby build to
explicitly set the `--target` flag during configuration. This
prevents Ruby's configure script from stripping the `gnu`
suffix from the triplet, which in turn prevents RubyGems from
"loosing" gems with compile extensions installed prior to an
upgrade to RubyGems 3.1.0 or newer.

Ref. ruby/rubygems#2922
Ref. ruby/ruby@5291197
Sharpie added a commit to Sharpie/puppet-runtime that referenced this pull request Aug 1, 2020
This commit updates the settings and components related to ruby-2.5.8
to allow it to be cross-compiled when the use_pl_build_tools setting
is set to `false` for a platform.

The DTrace bindings for Ruby are also universally skipped if the plaform
is being cross-compiled.

The setup currently assumes that the cross-compiled ruby will be used
by the build machine to install gems and run scripts. I.e. Linux binfmt
will be configured to run the foreign binaries under QEMU emulation.

This patch also updates the cross-compiled Ruby build to
explicitly set the `--target` flag during configuration. This
prevents Ruby's configure script from stripping the `gnu`
suffix from the triplet, which in turn prevents RubyGems from
"loosing" gems with compile extensions installed prior to an
upgrade to RubyGems 3.1.0 or newer.

Ref. ruby/rubygems#2922
Ref. ruby/ruby@5291197
Sharpie added a commit to Sharpie/puppet-runtime that referenced this pull request Aug 1, 2020
This commit updates the settings and components related to ruby-2.5.8
to allow it to be cross-compiled when the use_pl_build_tools setting
is set to `false` for a platform.

The DTrace bindings for Ruby are also universally skipped if the plaform
is being cross-compiled.

The setup currently assumes that the cross-compiled ruby will be used
by the build machine to install gems and run scripts. I.e. Linux binfmt
will be configured to run the foreign binaries under QEMU emulation.

This patch also updates the cross-compiled Ruby build to
explicitly set the `--target` flag during configuration. This
prevents Ruby's configure script from stripping the `gnu`
suffix from the triplet, which in turn prevents RubyGems from
"loosing" gems with compile extensions installed prior to an
upgrade to RubyGems 3.1.0 or newer.

Ref. ruby/rubygems#2922
Ref. ruby/ruby@5291197
Sharpie added a commit to Sharpie/puppet-runtime that referenced this pull request Aug 2, 2020
This commit updates the settings and components related to ruby-2.5.8
to allow it to be cross-compiled when the use_pl_build_tools setting
is set to `false` for a platform.

The DTrace bindings for Ruby are also universally skipped if the plaform
is being cross-compiled.

The setup currently assumes that the cross-compiled ruby will be used
by the build machine to install gems and run scripts. I.e. Linux binfmt
will be configured to run the foreign binaries under QEMU emulation.

This patch also updates the cross-compiled Ruby build to
explicitly set the `--target` flag during configuration. This
prevents Ruby's configure script from stripping the `gnu`
suffix from the triplet, which in turn prevents RubyGems from
"loosing" gems with compile extensions installed prior to an
upgrade to RubyGems 3.1.0 or newer.

Ref. ruby/rubygems#2922
Ref. ruby/ruby@5291197
Sharpie added a commit to Sharpie/puppet-runtime that referenced this pull request Aug 25, 2020
This commit updates the settings and components related to ruby-2.5.8
to allow it to be cross-compiled when the use_pl_build_tools setting
is set to `false` for a platform.

The DTrace bindings for Ruby are also universally skipped if the plaform
is being cross-compiled.

The setup currently assumes that the cross-compiled ruby will be used
by the build machine to install gems and run scripts. I.e. Linux binfmt
will be configured to run the foreign binaries under QEMU emulation.

This patch also updates the cross-compiled Ruby build to
explicitly set the `--target` flag during configuration. This
prevents Ruby's configure script from stripping the `gnu`
suffix from the triplet, which in turn prevents RubyGems from
"loosing" gems with compile extensions installed prior to an
upgrade to RubyGems 3.1.0 or newer.

Ref. ruby/rubygems#2922
Ref. ruby/ruby@5291197
lloeki added a commit to lloeki/rubygems that referenced this pull request Nov 24, 2020
Attempting to install a gem published as both *-linux and *-linux-musl
results in the incorrect gem being picked up, causing build failures due
to binary incompatibility. This is caused by the `nil` wildcard
swallowing the libc information upon version comparison.

Handle the linux case by performing only non-wildcard equality on the
version and asserting 'gnu' and nil equivalence, while preserving the
current behaviour for other OSes.

Followup to ruby#2922
Closes ruby#3174
@lloeki lloeki mentioned this pull request Nov 24, 2020
4 tasks
lloeki added a commit to lloeki/rubygems that referenced this pull request Feb 18, 2021
Attempting to install a gem published as both *-linux and *-linux-musl
results in the incorrect gem being picked up, causing build failures due
to binary incompatibility. This is caused by the `nil` wildcard
swallowing the libc information upon version comparison.

Handle the linux case by performing only non-wildcard equality on the
version and asserting 'gnu' and nil equivalence, while preserving the
current behaviour for other OSes.

Followup to ruby#2922
Closes ruby#3174
lloeki added a commit to lloeki/rubygems that referenced this pull request Mar 2, 2021
Attempting to install a gem published as both *-linux and *-linux-musl
results in the incorrect gem being picked up, causing build failures due
to binary incompatibility. This is caused by the `nil` wildcard
swallowing the libc information upon version comparison.

Handle the linux case by performing only non-wildcard equality on the
version and asserting 'gnu' and nil equivalence, while preserving the
current behaviour for other OSes.

Followup to ruby#2922
Closes ruby#3174
lloeki added a commit to lloeki/rubygems that referenced this pull request Mar 24, 2021
Attempting to install a gem published as both *-linux and *-linux-musl
results in the incorrect gem being picked up, causing build failures due
to binary incompatibility. This is caused by the `nil` wildcard
swallowing the libc information upon version comparison.

Handle the linux case by performing only non-wildcard equality on the
version and asserting 'gnu' and nil equivalence, while preserving the
current behaviour for other OSes.

Followup to ruby#2922
Closes ruby#3174
Sharpie added a commit to Sharpie/puppet-runtime that referenced this pull request May 13, 2021
This commit updates the settings and components related to ruby-2.5.8
to allow it to be cross-compiled when the use_pl_build_tools setting
is set to `false` for a platform.

The DTrace bindings for Ruby are also universally skipped if the plaform
is being cross-compiled.

The setup currently assumes that the cross-compiled ruby will be used
by the build machine to install gems and run scripts. I.e. Linux binfmt
will be configured to run the foreign binaries under QEMU emulation.

This patch also updates the cross-compiled Ruby build to
explicitly set the `--target` flag during configuration. This
prevents Ruby's configure script from stripping the `gnu`
suffix from the triplet, which in turn prevents RubyGems from
"loosing" gems with compile extensions installed prior to an
upgrade to RubyGems 3.1.0 or newer.

Ref. ruby/rubygems#2922
Ref. ruby/ruby@5291197
ivoanjo added a commit to DataDog/libdatadog that referenced this pull request Aug 18, 2022
Old versions of rubygems (for instance 3.0.3) don't properly detect
alternative libc implementations on Linux; in particular for our case,
they don't detect musl.

(For reference, Rubies older than 2.7 may have shipped with an affected
 version of rubygems).

In such cases, we fall back to use RbConfig::CONFIG['arch'] instead.

Why not use `RbConfig::CONFIG['arch']` always? Because
`Gem::Platform.local.to_s` does some normalization we want
in other situations -- for instance, it turns `x86_64-linux-gnu` to
`x86_64-linux`. So for now we only add this workaround in a specific
situation where we actually know it is wrong.

See also ruby/rubygems#2922 and
ruby/rubygems#4082

Fixes DataDog/dd-trace-rb#2222
ivoanjo added a commit to DataDog/libdatadog that referenced this pull request Aug 18, 2022
* Fix issue with old rubygems not detecting musl linux properly

Old versions of rubygems (for instance 3.0.3) don't properly detect
alternative libc implementations on Linux; in particular for our case,
they don't detect musl.

(For reference, Rubies older than 2.7 may have shipped with an affected
 version of rubygems).

In such cases, we fall back to use RbConfig::CONFIG['arch'] instead.

Why not use `RbConfig::CONFIG['arch']` always? Because
`Gem::Platform.local.to_s` does some normalization we want
in other situations -- for instance, it turns `x86_64-linux-gnu` to
`x86_64-linux`. So for now we only add this workaround in a specific
situation where we actually know it is wrong.

See also ruby/rubygems#2922 and
ruby/rubygems#4082

Fixes DataDog/dd-trace-rb#2222

* Bump libdatadog minor version in preparation for release

I'm planning to release 0.7.0.1.1 with the musl fix. This will be
automatically picked up by customers using the currently-released
version of dd-trace-rb (1.3.0).

* Fix file open permissions / directory creation

Otherwise this breaks in Linux due to the rest of the spec flow.

* Remove redundant directory creation in spec
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants