Package: patch
Version: 2.5.9-5
Severity: normal

I had some trouble applying a patch that was created using diff between
two files with CRLF line endings.  That process is out of my control
and cannot be changed.

As far as I can tell, the created diff has CRLF line endings like the
files; patch however drops the CR first but fails find a matching line
in the file to be patched then as the CR still exists there.

How to repeat:

$ echo -e "foo\r\nbar\r\nbaz\r\n" > rev.1
$ echo -e "foo\r\nbAr\r\nbaz\r\n" > rev.2
$ diff rev.1 rev.2 >diff
$ patch rev.1 diff 
(Stripping trailing CRs from patch.)
patching file rev.1
Hunk #1 FAILED at 2.
1 out of 1 hunk FAILED -- saving rejects to file rev.1.rej
$ 

Workaround: Remove the CR characters from to file to be patched before
running patch (tr -d '\r'), optionally also from the diff.

This cannot be cured easily as far as I can tell from the sources. Could
you please at least document it in the BUGS section so other people can
save the time I spent hunting down the problem?

Thanks,

    Christoph

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.25.4 (PREEMPT)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages patch depends on:
ii  libc6                         2.7-10     GNU C Library: Shared libraries

patch recommends no packages.

-- no debconf information

Attachment: signature.asc
Description: Digital signature

Reply via email to