Capistrano setup bails with RegexpErr on show_tasks

I am new to RoR, but I have had RoR running with Capistrano on a
different box. However I’m installing a fresh copy now and am finding
constant regex errors from the standard.rb file while attempting to
“show_tasks”. As this is a new installation, everything is up-to-date.

Here’s the environment:
FreeBSD 6.2-RC2
ruby 1.8.5
gem 0.9.0
rake 0.7.1
net-ssh 1.0.10, 1.0.9
net-sftp 1.1.0
capistrano 1.3.1, 1.2.0, 1.1.0

If I run the following commands:

mkdir newarea

cd newarea

rails newproject

cap -A newproject

cd newproject

which all appears to work properly outputting:

  exists  config
  create  config/deploy.rb
  exists  lib/tasks
  create  lib/tasks/capistrano.rake

So then I run:

cap show_tasks

which bails with the following:

  • executing task show_tasks
    Available tasks

/usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/lib/capistrano/recipes/standard.rb:30:in
load': target of repeat operator is invalid: /(.{1,56})(?:\s|\Z)+/ (RegexpError) from /usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/lib/capistrano/actor.rb:179:ineach_task’
from
/usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/lib/capistrano/actor.rb:176:in
each' from /usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/lib/capistrano/actor.rb:176:ineach_task’
from
/usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/lib/capistrano/recipes/standard.rb:28:in
load' from /usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/lib/capistrano/actor.rb:159:ininstance_eval’
from
/usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/lib/capistrano/actor.rb:159:in
show_tasks' from /usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/lib/capistrano/cli.rb:271:insend’
from
/usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/lib/capistrano/cli.rb:271:in
execute_recipes!' from /usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/lib/capistrano/cli.rb:271:ineach’
from
/usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/lib/capistrano/cli.rb:271:in
execute_recipes!' from /usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/lib/capistrano/cli.rb:247:inexecute!’
from
/usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/lib/capistrano/cli.rb:12:in
execute!' from /usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/bin/cap:11 from /usr/local/bin/cap:18:inload’
from /usr/local/bin/cap:18

There are no modified ruby files whatsoever. Is there a system regex
library problem perhaps?

Thanks for any help.

In case anyone else comes across this, I did find a fix by removing the
\Z anchor from the default show_tasks task:

desc “Enumerate and describe every available task.”
task :show_tasks do
puts “Available tasks”
puts “---------------”
each_task do |info|
wrap_length = 80 - info[:longest]
lines = info[:desc].gsub(/(.{1,#{wrap_length}})(?:\s)+/,
“\1\n”).split(/\n/)

lines = info[:desc].gsub(/(.{1,#{wrap_length}})(?:\s|\Z)+/,

“\1\n”).split(/\n/)
puts “%-#{info[:longest]}s %s” % [info[:task], lines.shift]
puts “%#{info[:longest]}s %s” % ["", lines.shift] until lines.empty?
puts
end
end

I’m not sure why this is a problem, considering the line is the same as
in early versions of capistrano which I have had working without
modification.