capistrano / rails

Official Ruby on Rails specific tasks for Capistrano
http://www.capistranorb.com/
MIT License
867 stars 270 forks source link

cp: cannot stat #169

Closed ngw closed 8 years ago

ngw commented 8 years ago

Hi *, I have a weird bug very similar to many others already solved by capistrano-rails but slightly different, where none of the fixes I've tried so far works. It appears it's adding for no good reason some gibberish when it creates the manifest path, and I really have no idea where to watch to fix it...

This is the error: cp: cannot stat ‘\033[?25h\033[0G\033[K\033[?25h\033[0G\033[K/home/deployer/apps/errbit/releases/20160426095529/public/assets/.sprockets-manifest-cd1becb3ebe39b1efd086cd82910b5dd.json’

downgrading sprockets to sprockets-2.12.4 doesn't work, with exactly the same problem Here is the output when I attempt a production deploy:

https://gist.github.com/ngw/bef9a26b9536a7f782c8a8c1e7db303f

And here the Gemfile.lock

https://gist.github.com/ngw/1157a005ff7f6077b9f5b232b0371a76

Any ideas?

mattbrictson commented 8 years ago

Hi, I believe this because capistrano-rails is using ls to determine the manifest name. As others have pointed out, using ls for this purpose is dangerous, because there is no guarantee of the format of the ls output.

In your case my guess is that your version of ls is printing ansi color codes (?) or some other formatting characters that capistrano-rails is assuming are part of the manifest name.

I would check on your server if there is a .bashrc or some other configuration file that might be affecting the default ls output.

Just a guess!

dpritchett commented 8 years ago

+1 here:

failed: "sh -c 'mv -- '\\'''\\'' /var/www/sites/dpritchettapp.com/current/assets_manifest'" on staging-li.dpritchettapp.net

Longer log: https://gist.github.com/dpritchett/bc5506f8b50098312fd443af665c0118

mattbrictson commented 8 years ago

@dpritchett I am confused by your error message. The code for capistrano-rails uses cp to backup the manifest, not mv. Where is sh -c 'mv ... coming from? Also what is printing the message Backing up shared manifest? That isn't in capistrano-rails either. Have you changed the code?

dpritchett commented 8 years ago

Yeah, so I foolishly ctrl-Ced out of a deploy and left my shared/assets folder kinda hosed. I 'fixed' it as follows:

# on the server
touch shared/assets/manifest.yml  # create an empty file #yolo

# on my machine
cap staging deploy:rollback
cap staging deploy

Not much to see here in my case I guess. Thanks!

mattbrictson commented 8 years ago

Closing due to inactivity.