Skip to content

Ruby 3.2.11 for ubuntu-26.04 isn't linked against libcrypt: String#crypt ignores $1$/$5$/$6$ salts #985

Backlog

Description

@silug

Ensure the following before filing this issue

  • I verified it reproduces with the latest version with - uses: ruby/setup-ruby@v1 (see Versioning policy)
  • I tried to reproduce the issue locally by following the workflow steps (including all commands done by ruby/setup-ruby, except for Downloading Ruby & Extracting Ruby),
    and it did not reproduce locally (if it does reproduce locally, it's not a ruby/setup-ruby issue)

Are you running on a GitHub-hosted runner or a self-hosted runner?

GitHub-hosted runner

Link to the failed workflow job (must be a public workflow job, so the necessary information is available)

https://github.com/simp/pupmod-simp-simplib/actions/runs/44468083095/job/135370960820

Any other notes?

The Ruby 3.2.11 build for Ubuntu 26.04 (ruby-3.2.11-ubuntu-26.04-x64.tar.gz from ruby/ruby-builder) isn't linked against libcrypt, so String#crypt falls back to Ruby's built-in DES-only implementation and ignores $1$/$5$/$6$ (MD5/SHA-256/SHA-512) salts:

'reallybadpassword'.crypt('$6$badsalt')
# ubuntu-26.04 build: "$6aEPTnyKi88Q"  (13-character DES hash)
# expected:           "$6$badsalt$hk7dh/Mz.oPuPZgDkPrNU/WSQOOq6T8PA8FO4mmLkfGdgvyEvqd8HyD5UeD2aYysmczplpo5qkU8RYjX1R6LS0"

In the linked job, ruby-version: 3.2.11 resolved to the copy the ubuntu-26.04 runner image preinstalls in /opt/hostedtoolcache/Ruby/3.2.11/x64. That copy is the same ruby-builder asset.

I compared builds in containers (ldd on bin/ruby and lib/libruby.so.3.2, then the crypt call above):

Ruby 3.2.11 Platform libcrypt linked $6$ result
ruby-builder ruby-3.2.11-ubuntu-26.04-x64 ubuntu:26.04 no DES (wrong)
ruby-builder ruby-3.2.11-ubuntu-24.04-x64 ubuntu:24.04 libcrypt.so.1 correct
built from the ruby-lang.org tarball (sha256 matches), GCC 15.2.0, libcrypt-dev 1:4.5.1-1 ubuntu:26.04 libcrypt.so.1 correct
official ruby:3.2 image Debian 13 libcrypt.so.1 correct

The local source build's configure finds everything on 26.04 (crypt in -lcrypt... yes, crypt_r... yes, crypt.h... yes), so Ruby 3.2 itself builds correctly there.

Only this one asset seems to be affected. The 26.04 x64 builds of 3.3.14, 3.4.13 and 4.0.10 (published 2026-11-18) all link libcrypt and return correct $6$ hashes. The 3.2.11 26.04 asset was uploaded on 2026-06-20, during the Ubuntu 26.04 preview, so its build environment probably lacked libcrypt-dev (libxcrypt) at that time. I haven't checked the arm64 asset.

I realise Ruby 3.2 is EOL. Would it be possible to rebuild ruby-3.2.11-ubuntu-26.04-x64 (and arm64, if it's affected too) in the current 26.04 environment? Ruby 3.2 is still the Ruby that OpenVox/Puppet 8 agents ship, so projects keep testing against it.

Activity

  1. eregon commented on Nov 24, 2026

    @eregon
    Member

    Related: https://bugs.ruby-lang.org/issues/14915#note-58
    crypt() is an horrible mess, the docs already say it shouldn't be used.

    That said if indeed it's just one build missing it that's surprising.

    Could you make a PR changing https://github.com/ruby/setup-ruby/blob/master/.github/workflows/test.yml to add a test for this and then we can see which versions fail?

  2. silug commented on Nov 25, 2026

    @silug
    Author

    Could you make a PR changing https://github.com/ruby/setup-ruby/blob/master/.github/workflows/test.yml to add a test for this and then we can see which versions fail?

    @eregon #986 needs an approval for the workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions