On Sat, Jul 18, 2015 at 05:46:17PM -0700, Jörn Engel wrote: > On Sat, Jul 18, 2015 at 10:25:52PM +0200, Andreas Grünbacher wrote: > > > > I have tried removing this heuristic in the past. The result was lots > > of misapplied patches. I couldn't think of a better heuristic either. > > Changing these kinds of things is difficult: for example, distributions > > are using patch for applying hundreds of thousands of patches > > automatically during package builds. These kinds of mis-applied > > patches are relatively likely not to not lead to subsequent errors > > (like syntax errors in a C file). > > I agree it is hard. Another weird effect we saw was with repetitive > code. The context for a patch existed twice in the same C file. Git > picked one of them, patch the other. Because some of us use git > quiltimport and other use quilt we eventually noticed the problem. And > only because we had a compiler error - backtracking from runtime > failures to misapplied patches would be a nightmare.
Just occurred to me. For my problem at least, there should be a --paranoid option and mode. When paranoid you look for multiple locations to apply the patch. If you find more than one, treat it like a conflict and ask a human to intervene. Almost certain to slow things down, but running it once in a while to catch problems would be useful. Or as a parallel verification step while distro build is ongoing or something. Jörn -- Was there any time in human history where democratic forms continued when the citizens could not credibly defend their rights? -- Daniel Suarez