Patch: Accept CR/LF line breaks in exclude files
mbp at samba.org
Fri Feb 22 07:02:34 EST 2002
On 21 Feb 2002, Dave Dykstra <dwd at bell-labs.com> wrote:
> On Thu, Feb 21, 2002 at 11:10:50AM -0600, Dave Dykstra wrote:
> > On Tue, Feb 19, 2002 at 04:30:53PM -0600, Jordan Russell wrote:
> > > use CR/LF (DOS-style) line breaks. It basically behaves as if the files are
> > > empty. This is rather annoying if the exclude files are generated by Windows
> > > systems (e.g. if you're using --cvs-exclude and rsync'ing the contents of a
> > > Samba share that includes .cvsignore files).
> > >
> > > Attached is a simple 1-line patch (for 2.5.2) which "fixes" this; it strips
> > > off any CR character at the end of the line. Could it be committed?
> > >
> > > Jordan Russell
> > Are you talking about on Cygwin or on some native unix? I'm not sure it
> > makes sense to modify rsync to strip off carriage returns from every file
> > it reads. On the other hand, that makes more sense than doing it for just
> > exclude files. On Cygwin it should, certainly, but I think the cygwin
> > option to handle that automatically has already been enabled.
> Oops, I should have read through all the messages first. Rsync is not
> doing that on Cygwin, and Ville Herva's patch addresses that.
There is one scenario where it will not, which is when running on
Unix, but manipulating .cvsignore or other text files created by a
Windoze program. As far as I can see, this will not be handled by
Ville Herva's good patch, because Unix does nothing special when you
open a file in text mode.
(Seeing as we're on Samba.org we kind of ought to handle it :-)
Obviously files being transferred should always be sent byte-for-byte
regardless of platform.
However, when reading text formatted files for our own use, it is
probably better to be "generous in what we accept" with regard to line
endings. I think we ought to accept a patch that makes rsync agnostic
about CR, CRLF, or LF at the end of lines in password, config, and
cvsignore files. (I think Python now does this on all platforms.)
It's hard to imagine somebody specifically wanting a CR character in
any of them to be treated literally.
More information about the rsync