From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 4310 invoked from network); 22 May 2022 22:59:21 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 22 May 2022 22:59:21 -0000 Received: from mimir.eigenstate.org ([206.124.132.107]) by 9front; Sun May 22 18:57:46 -0400 2022 Received: from abbatoir.myfiosgateway.com (pool-74-108-56-225.nycmny.fios.verizon.net [74.108.56.225]) by mimir.eigenstate.org (OpenSMTPD) with ESMTPSA id ef530169 (TLSv1.2:ECDHE-RSA-AES256-SHA:256:NO) for <9front@9front.org>; Sun, 22 May 2022 15:57:33 -0700 (PDT) Message-ID: <8A703EB8EACED4EFE003DD77486E70FE@eigenstate.org> To: 9front@9front.org Date: Sun, 22 May 2022 18:57:32 -0400 From: ori@eigenstate.org MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: virtual standard service deep-learning software-oriented manager Subject: [9front] patch: import replacement for ape/patch Reply-To: 9front@9front.org Precedence: bulk We've been dragging along an antique version of Gnu patch as part of ape. It's a bulky program with built in remote code execution as part of ed-style diffs. I'd like to eventually kill it. Let's start by adding a replacement: diff 6fbb1acc8fa0b6655b14e8c46240a4a8d2d8c672 uncommitted --- /dev/null +++ b//sys/man/1/patch @@ -1,0 +1,57 @@ +.TH PATCH 1 +.SH NAME +patch \- apply diffs +.SH SYNOPSIS +.B patch +[ +.B -R +] +[ +.B -p +.I nstrip +] +[ +.B -f +.I maxfuzz +] +[ +.B patch... +] +.SH DESCRIPTION +.I Patch +will take a patch file in unified diff format, and apply it, +skipping leading and trailing junk. +If the file is not an exact match, it will search forwards and +backwards for the surrounding context up to +.I maxfuzz +lines. + +The following options are supported: +.TP +.I -R +Reverse direction of the patch. Addtions become removals, +and the new and old file names are swapped. +.TP +.I -p nstrip +Remove +.I nstrip +elements from the paths to the files. +.TP +.I -f maxfuzz +Controls how far +.I patch +searches for context when applying a patch. +.SH SEE ALSO +.IR diff (1) +.IR git/export (1) + +.SH BUGS +.PP +The output of +.IR diff -c +is not handled +.PP +Reject files and backups are not supported +.PP +All files are processed in memory, which limits +the files handled to 2 gigabytes.