rbenv / ruby-build

A tool to download, compile, and install Ruby on Unix-like systems.
https://rbenv.org/man/ruby-build.1
MIT License
3.89k stars 785 forks source link

RUBY_BUILD_ROOT docs misleading #2391

Closed jasonkarns closed 5 months ago

jasonkarns commented 5 months ago

Steps to reproduce the behavior

  1. have directory containing build definitions at /tmp/rby/<defn_files>
  2. run: RUBY_BUILD_ROOT=/tmp/rby ruby-build --list

Expected vs. actual behavior

Expected: listing of files in /tmp/rby Actual: nothing listed

The docs state that RUBY_BUILD_ROOT may point to a custom directory that contains build definition files. Specifically, that the default is "share/ruby-build".

Custom build definition directory. (Default: share/ruby-build)

In actuality, RUBY_BUILD_ROOT must point to a directory that contains a share/ruby-build/ directory that may contain definition files. Note how it is used by concatenating with "share/ruby-build": https://github.com/rbenv/ruby-build/blob/210578da4c2f7252fd5b60227d124e28f20c590b/bin/ruby-build#L1367

The default is in fact found by resolving where the ruby-build executable is, which is assumed to have a share/ruby-build dir.

This has been the behavior for as long as RUBY_BUILD_ROOT as been configurable: https://github.com/rbenv/ruby-build/commit/ff75ca72045ce54b4c47d1b5c51e3d921cc63c96

Given that the behavior has not changed, and that changing it now would be a breaking change, I propose that only the readme be updated to clarify the true behavior. (I'll open a PR soon.)