Rake rule with proc always errors on Ruby 3.4
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- ruby
- Domain
- build-system
Research direction
The trace points to lib/rake/task_manager.rb, especially make_sources() around the Pathname case; begin there and check how proc-based rule sources are handled. Reproduce the report with the Ruby 3.4 example and run the relevant task manager tests. Done means the rule with a proc source no longer raises NameError and the tests cover the behavior.
Written by the indexing model from the issue text.
Description
I'm using the latest Arch packages for Ruby and Rake.
$ ruby --version
ruby 3.4.12 (2026-10-23 revision 366f5fdc00) +PRISM [armv7l-linux-eabihf]
$ rake --version
rake, version 13.4.2
The following Rake file does not work:
task :html => ["ch1.html"]
rule '.html' => [-> (name) { 'src/' + name + '.md' }] do
puts 'foo'
end
$ rake html
rake aborted!
NameError: uninitialized constant Rake::TaskManager::Pathname (NameError)
when Pathname
^^^^^^^^
Tasks: TOP => html
(See full trace by running task with --trace)
The full trace shows that Pathname is used in task_manager.rb without being required. But as I understand it Pathname was only moved into Ruby core in Ruby 4.0.
$ rake html --trace
** Invoke html (first_time)
rake aborted!
NameError: uninitialized constant Rake::TaskManager::Pathname (NameError)
when Pathname
^^^^^^^^
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/task_manager.rb:305:in 'block in Rake::TaskManager#make_sources'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/task_manager.rb:294:in 'Array#map'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/task_manager.rb:294:in 'Rake::TaskManager#make_sources'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/task_manager.rb:272:in 'Rake::TaskManager#attempt_rule'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/task_manager.rb:156:in 'block in Rake::TaskManager#enhance_with_matching_rule'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/task_manager.rb:154:in 'Array#each'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/task_manager.rb:154:in 'Rake::TaskManager#enhance_with_matching_rule'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/task_manager.rb:57:in 'Rake::TaskManager#[]'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/task.rb:66:in 'Rake::Task#lookup_prerequisite'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/task.rb:62:in 'block in Rake::Task#prerequisite_tasks'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/task.rb:62:in 'Array#map'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/task.rb:62:in 'Rake::Task#prerequisite_tasks'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/task.rb:241:in 'Rake::Task#invoke_prerequisites'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/task.rb:218:in 'block in Rake::Task#invoke_with_call_chain'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/task.rb:199:in 'Monitor#synchronize'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/task.rb:199:in 'Rake::Task#invoke_with_call_chain'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/task.rb:188:in 'Rake::Task#invoke'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/application.rb:183:in 'Rake::Application#invoke_task'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/application.rb:139:in 'block (2 levels) in Rake::Application#top_level'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/application.rb:139:in 'Array#each'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/application.rb:139:in 'block in Rake::Application#top_level'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/application.rb:148:in 'Rake::Application#run_with_threads'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/application.rb:133:in 'Rake::Application#top_level'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/application.rb:84:in 'block in Rake::Application#run'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/application.rb:209:in 'Rake::Application#standard_exception_handling'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/lib/rake/application.rb:81:in 'Rake::Application#run'
/usr/lib/ruby/gems/3.4.0/gems/rake-13.4.2/exe/rake:27:in '<top (required)>'
/usr/bin/rake:25:in 'Kernel#load'
/usr/bin/rake:25:in '<main>'
Tasks: TOP => html
The rule has to have a proc and not just a string. I assume this is because otherwise the string case in make_sources() is matched before the Pathname is hit.
- Dominant language
- Ruby
- Stars
- 2.5k
- Forks
- 649
- Avg merge
- 4m
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ruby/rake
-
rake -P output is ambiguous with prereq namespacesPossibly taken @leoarnold claimed this 110 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 5/5 Over a week Newbie friendliness 28/100
-
FileList#<< bypasses exclusions while FileList#include respects themPossibly taken @hsbt claimed this 124 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
cline/mcp-marketplace#3886 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
jetrockets/recorder#61 ·
-
PROJECT: website-redesign
Difficulty 1/5 Under an hour Newbie friendliness 72/100
thewca/worldcubeassociation.org#16617 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day