Bug 66826 - patch 2.7 / line-ending issue
Summary: patch 2.7 / line-ending issue
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
4.1.0.0.alpha0+ Master
Hardware: Other Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:4.2.0 target:4.1.1
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-11 16:07 UTC by Michael Meeks
Modified: 2023-11-20 18:34 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Meeks 2013-07-11 16:07:04 UTC
I've been trying to debug a nasty with building on a recent cygwin. It seems that the new version of patch has a <cough> non-optimal feature.

$ untar lp_solve...
$ patch --dry-run -p2 < /opt/libreoffice/calc-group-interpreter/lpsolve/lp_solve_5.5-windows.patch
checking file lpsolve55/cgcc.bat
Hunk #1 FAILED at 7 (different line endings).
1 out of 1 hunk FAILED
checking file lpsolve55/lpsolve.rc
Hunk #1 FAILED at 7 (different line endings).
1 out of 1 hunk FAILED
checking file lpsolve55/cvc6.bat
Hunk #1 FAILED at 14 (different line endings).
1 out of 1 hunk FAILED
michael@linux-9ia1:/ssd/opt/libreoffice/calc-group-interpreter/foo/lp_solve_5.5> patch --version
GNU patch 2.7.1
Copyright (C) 2003, 2009-2012 Free Software Foundation, Inc.
Copyright (C) 1988 Larry Wall

This is not ideal - so convert the line-endings to DOS in the patch:

$ unix2dos /opt/libreoffice/calc-group-interpreter/lpsolve/lp_solve_5.5-windows.patch
$ patch --dry-run -p2 < /opt/libreoffice/calc-group-interpreter/lpsolve/lp_solve_5.5-windows.patch
(Stripping trailing CRs from patch; use --binary to disable.)
checking file lpsolve55/cgcc.bat
Hunk #1 FAILED at 7 (different line endings).
1 out of 1 hunk FAILED
(Stripping trailing CRs from patch; use --binary to disable.)
checking file lpsolve55/lpsolve.rc
Hunk #1 FAILED at 7 (different line endings).
1 out of 1 hunk FAILED
(Stripping trailing CRs from patch; use --binary to disable.)
checking file lpsolve55/cvc6.bat
Hunk #1 FAILED at 14 (different line endings).
1 out of 1 hunk FAILED

As you see patch carefully does:
"(Stripping trailing CRs from patch; use --binary to disable.)"

and then (because they are missing) refuses to apply the patch :-)

Doh.
Comment 1 Michael Meeks 2013-07-11 16:10:49 UTC
Attempting to mix Unix + Dos newlines in the patch doesn't encourage patch not to mangle the line-endings and then fail horribly.

The only fix appears to be adding --binary to the patch command-line.
Comment 2 Michael Meeks 2013-07-11 16:25:53 UTC
pushed patches variously at least to master / 4.1.
Comment 3 Commit Notification 2013-07-11 16:30:59 UTC
Michael Meeks committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d35cf5e19652989419aa598119ccd978307111fe

fdo#66826 - Add DOS CR/LR line endings to please patch 2.7 under cygwin



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2013-07-11 19:13:29 UTC
Michael Meeks committed a patch related to this issue.
It has been pushed to "libreoffice-4-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=89c4c2ea0d1c96559e85814805704dfbe053534f&h=libreoffice-4-1

fdo#66826 - Add DOS CR/LR line endings to please patch 2.7 under cygwin


It will be available in LibreOffice 4.1.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 5 Michael Meeks 2013-07-11 19:43:00 UTC
As if by a miracle - patch 2.6 then refuses to apply the patch fixed up such that 2.7 can apply it [urgh]. So this is really no fix at all.

I guess passing --binary to patch would make it work for both cases, but ... there is no gnumake conditional to add patch arguments currently.
Comment 6 Commit Notification 2013-07-11 20:04:32 UTC
Michael Meeks committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e962805b31074d6b6a2ed0db6452769448337553

fdo#66826 - Allow parameters to be passed to patch such as --binary



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 7 Commit Notification 2013-07-11 20:13:22 UTC
Michael Meeks committed a patch related to this issue.
It has been pushed to "libreoffice-4-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f1e7eeb83c18bce720d49e0e55704abd09ab96f7&h=libreoffice-4-1

fdo#66826 - Allow parameters to be passed to patch such as --binary


It will be available in LibreOffice 4.1.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 8 Mike Kaganski 2023-11-20 18:34:03 UTC
This shows, that I followed the correct path when needed to build a 4.0 version now :-)