Renaud Allard <[email protected]> wrote: > On 4/3/26 12:04 PM, Omar Polo wrote: > > [...] > > then, why don't just advance one line, and re-enter intuit_diff_type? > > it would guarantee that we reach eof at some point and exit. > > I have been going back and forth with your idea. > > A user would maybe want patch to continue. But intuit_diff_type picks up > any line starting with "@@ -" as a unified diff and also extracts > filenames from "---"/"+++" lines. Garbled input could match these > patterns and cause patch to silently write to unintended files or create > files with arbitrary names. It think stopping is safer even if frustrating.
actually i was a bit too fast with my previous replies. I failed to see that intuit_diff_type is actually going on quite a bit before giving up, which means that I'm fine to have patch failing if there is no progress. I'm less happy about the use of a static variable to do so, but we don't have much state anyway and it could be acceptable.
