Line endings difference Windows <-> Linux

Bo Berglund bo.berglund at gmail.com
Mon Jun 10 19:24:36 UTC 2013


On Mon, 10 Jun 2013 13:50:00 -0500, "Christofer C. Bell"
<christofer.c.bell at gmail.com> wrote:

>On Mon, Jun 10, 2013 at 1:38 PM, Bo Berglund <bo.berglund at gmail.com> wrote:
>
>>
>> So here is my simple question:
>> Has Apache/PHP/MySql been adapted to accept all line ending systems
>> around without breaking like in the old days?
>> If that is so then I can stop worrying about line endings in the
>> future. :-)
>
>
>
>I can't answer your question, but I can say you might consider installing
>the package dos2unix.  It includes the commands dos2unix and unix2dos for
>converting the line endings in ascii files automatically.  I won't convert
>what doesn't need converting, either.  So you can run "dos2unix" twice on
>the same file and still have the Unix format file.  You can run it in
>binaries (images, programs) and it won't corrupt them.
>
>Convert your entire website at once:
>
>$ find /var/www | xargs -r dos2unix
>
>I hope this helps!

Well, things are a bit complex.
I check out the files from CVS to my Windows7 machine and I commit
back when they are edited. On Windows this requires them to be using
CRLF line endings.
I have also used an Apache server on my Win7 PC to check the site
before sending to the real server. This worked fine until I had to
start doing MySql stuff too. Much too complex to install in Win7...

So I created an Ubuntu test machine (VMWare virtualization) and got
the needed website stuff:
apt-get install lamp-server^
was all I needed to do! :-)

Over the weekend I have also struggled to make rsync over ssh work and
I finally succeeded, so when I have edited the site files in Windows I
can just launch a batch file with my rsync commands to update the
website on ubuntu with the changed files.
Then I can test it.

But it is not possible to do rsync to the web hosting company so I am
limited to FTP or sFTP, and here is where I saw the line ending
"problem".

If it is not a problem then fine, otherwise I will have to be vary
careful every time I update the public server....


-- 
Bo Berglund
Developer in Sweden





More information about the ubuntu-users mailing list