I've come to the same conclusion. I'm not using file-based rails
caching. I'm just using it for deploying a PHP site and have
overridden a lot of the rails specific tasks in deploy.
The ordering of the releases from 'ls -xt' is the problem, but the
reason I think they're in the wrong order is because of the
timestamps. While the deploy task is running I can see that the new
release folder has correct timestamp ie now, but at the end of the
deploy task 'something' is setting the modification date of ALL the
release folders to the same timestamp, and it's completely wrong
(12-24 hours ago). Then the deploy:rollback gets it completely wrong
and the problem occurs.
Can you confirm if you're seeing the same behaviour?
I'm still trying to work out exactly where it's going wrong. I'm
trying touching release folders using before_ and after_ but still
haven't got a working solution.