A little Subversion gotcha

Comments

At the office, my development machine is (unfortunately) a Windows box. I was setting up Capistrano for an app I was about to deploy, and checked the deploy.rb, Capfile, and script/spin files into Subversion from my Windows machine. This led to an interesting little gotcha.

This app has a small user base, so I opted to only spawn two instances of Mongrel with the -i 2 option in script/spin, but for some reason, when deploying, I was still starting 3 each time. A quick analysis of the nohup.out file that gets created when starting the servers showed a message that -i 2 was an invalid option, and it was reverting to defaults. Of course, -i 2 is a valid option, so I was perplexed. Turns out, the Linux machine I was checking the source out to wasn't liking the carriage returns from Windows. Windows uses CRLF as a line terminator, while UNIX-like platforms use LF only. This isn't a problem for most files, really, but in the case of scripts like this one, having a bogus CR on the end of the line was causing it to be passed as part of the parameter.

The solution? Subversion's svn:eol-style property. Setting this to "native" for a file causes it to receive the proper end-of-line treatment on the system that checks it out. Problem solved.

comments powered by Disqus