1

In the process of comparing files between 2 versions of an application i've noticed that a number of files seem to have gained additional blank lines throughout the file. These files were never uploaded by FTP, purely copied from one location to another using cp and its not even every single file in the directory, just seemingly random ones. When i do a diff between the files in a side by side format ignoring spaces, newlines etc i just see a bunch of caveats showing the difference as the new line, so this:

diff --suppress-common-lines -Bbwy /home/site1/public_html/file.php /home/site2/public_html/file.php

outputs something like this:

>
>
>
>
>
>

I guess this is 2 questions then:

why would the file have gained these extra new lines, is this a line ending issue somehow and how can i check?

Is it possible to do a diff that will completely ignore these lines and recognise the files as identical which essentially they seem to be?

FYI this is on a CentOS server.

  • I think we need to see exactly what technique you're using to copy the files. Newlines are just bytes, and it's approaching impossible that 'cp' is adding bytes to your files. Are you certain that an editor hasn't opened one copy or the other in the meantime? – pboin Jul 6 '11 at 12:14
  • MSDOS/FAT/VFAT filesystems have auto conversion options. Maybe one of the locations is such an FS. – AndreasM Jul 12 '11 at 6:27
1

It seems that this was caused by another Developer having an auto-sync setting with his copy of Dreamweaver.

0

Part 1: Could be several things, like pboin mentioned, if you open it in an editor, it can add a newline or convert line endings, or I commented, if the source or target file system is an MSDOS/FAT partition.

Part 2: try --strip-trailing-cr

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.