Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #3223 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

Multiple users problem in Switchtower

Reported by: m.stienstra@fngtps.com Assigned to: jamis@37signals.com
Priority: high Milestone:
Component: Capistrano Version: 1.0.0
Severity: major Keywords:
Cc:

Description

In SwitchTower::SCM::Base#run_checkout Swithtower does a chmod 666 #{log}, when this is run by a different user than the person who created the file, you get a permission error.

From the chmod manual: Only the owner of a file or the super-user is permitted to change the mode of a file.

When work around this problem, the next thing I encounter is permission trouble deleting the symlink to the current version.

run "ln -nfs #{current_release} #{current_path}"

You can't change a symlink when you're not the owner, in fact, on Linux you can't even delete the symlink if you're not the owner.

As a temporary solution I tried to change the permission of the troublesome files, but when the list of files started growing I solved it by doing the following:

desc "Change permission of the project to avoid the problems with source.checkout and symlink" task :before_update_code do

sudo "chown -R $USER #{deploy_to}"

end

desc "Set permissions on files" task :after_symlink do

sudo "chgrp -R www #{deploy_to}" sudo "chgrp -R www #{current_path}" sudo "chgrp -R www-data #{shared_path}/log" sudo "chgrp -R www-data #{shared_path}/system"

end

We're deploying from OSX to Ubuntu Breezy. FYI: Ubuntu uses a default group the same as the username. So files become user:user by default, although this is only part of the problem.

Change History

01/21/06 04:34:37 changed by minam

  • status changed from new to closed.
  • resolution set to fixed.

The chmod is now only done when the revisions.log file is first created. That ought to take care of this problem.

03/15/06 13:57:20 changed by jason.garber@emu.edu

  • priority changed from normal to high.
  • status changed from closed to reopened.
  • resolution deleted.
  • severity changed from normal to major.

Problem is not fixed because of operator precedence. At least on my box, the test evaluates to true, so the touch is skipped but the chmod is attempted).

Change line 56 of scm/base.rb to

"(test -e #{log} || (touch #{log} && chmod 666 #{log})) && " +

We've patched our system, but please fix in the next release.

03/18/06 23:12:13 changed by minam

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [3957]) Fix operator precedence problem in script for touching the revisions.log (closes #3223)

06/21/06 19:59:59 changed by jason.young@extension.org

  • status changed from closed to reopened.
  • resolution deleted.

This is not in the Capistrano 1.1.0 gem - when should this fix make it into a capistrano gem release?

Thanks!

07/06/06 03:31:18 changed by minam

  • status changed from reopened to closed.
  • resolution set to fixed.

This will be released in the next week. Sorry to take so long between releases.