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.

robjmills
  • 990
  • 9
  • 26
  • 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 06 '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 06:27

2 Answers2

1

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

robjmills
  • 990
  • 9
  • 26
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

AndreasM
  • 1,083
  • 8
  • 13