Re: [RFC] patch's default backup behavior

From: Pau Amma <pauamma_at_gundo.com>
Date: Mon, 11 Apr 2022 16:42:18 UTC
On 2022-04-09 03:25, Kyle Evans wrote:
> FreeBSD's patch follows historical patch(1) behavior w.r.t. backups,
> where a backup is created for every file patched.
> 
> I'd like to test the waters on switching this to the GNU behavior,
> which feels a whole lot more reasonable. Notably, they'll only create
> backup files if a mismatch was detected

I don't know what GNU patch does, but I had a look at SUSv4, which says 
-b always creates .orig files and not using -b never does. But you sound 
like you're actually speaking of .rej files, not .orig files.

> (presumably this means either
> a hunk needed fuzz or a hunk outright failed).

SUSv4 says a .rej is created when applying the hunk fails completely, 
but not if the before context is found after fuzzing, that is 
either/both near where if was expected and after trimming some outer 
lines of it. (There's no option to control whether/when a .rej is 
created.)

> This yields far fewer
> backup files in the ideal scenario (context entirely matches), while
> still leaving backup files when it's sensible (base file changed and
> we might want to regenerate the patch).

I feel that way about the SUSv4 version, but I'm not sure how conformant 
the GNU version is, or what you think should happen with respect to .rej 
files.

> Thoughts / comments / concerns? Cross-posted this to a couple of
> different lists to try and hit the largest number of stakeholders in
> patch(1) behavior.

I'm not sure -arch@ will accept my reply. This may or may not split the 
discussion.

-- 
#BlackLivesMatter #TransWomenAreWomen #AccessibilityMatters 
#StandWithUkrainians
English: he/him/his (singular they/them/their/theirs OK)
French: il/le/lui (iel/iel and ielle/ielle OK)
Tagalog: siya/niya/kaniya (please avoid sila/nila/kanila)