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

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’
each' from /usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/lib/capistrano/actor.rb:176:ineach_task’
load' from /usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/lib/capistrano/actor.rb:159:ininstance_eval’
show_tasks' from /usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/lib/capistrano/cli.rb:271:insend’
execute_recipes!' from /usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/lib/capistrano/cli.rb:271:ineach’
execute_recipes!' from /usr/local/lib/ruby/gems/1.8/gems/capistrano-1.3.1/lib/capistrano/cli.rb:247:inexecute!’
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)+/,

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

puts “%-#{info[:longest]}s %s” % [info[:task], lines.shift]
puts “%#{info[:longest]}s %s” % ["", lines.shift] until lines.empty?

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