From owner-freebsd-questions@freebsd.org Fri Aug 13 02:05:46 2021 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F193676508 for ; Fri, 13 Aug 2021 02:05:46 +0000 (UTC) (envelope-from zarniwhoop@ntlworld.com) Received: from smtpq1.tb.ukmail.iss.as9143.net (smtpq1.tb.ukmail.iss.as9143.net [212.54.57.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gm6N94hhMz4cCg for ; Fri, 13 Aug 2021 02:05:45 +0000 (UTC) (envelope-from zarniwhoop@ntlworld.com) Received: from [212.54.57.108] (helo=csmtp4.tb.ukmail.iss.as9143.net) by smtpq1.tb.ukmail.iss.as9143.net with esmtp (Exim 4.86_2) (envelope-from ) id 1mEMZm-0005R5-51 for freebsd-questions@freebsd.org; Fri, 13 Aug 2021 04:05:38 +0200 Received: from llamedos.mydomain ([81.97.236.130]) by cmsmtp with ESMTPA id EMZlmBkRpXATfEMZmmZcrp; Fri, 13 Aug 2021 04:05:38 +0200 X-Originating-IP: [81.97.236.130] X-Authenticated-Sender: zarniwhoop@ntlworld.com X-Authority: v=2.4 cv=MaEPB7zf c=1 sm=1 tr=0 ts=6115d372 cx=a_exe a=OGiDJHazYrvzwCbh7ZIPzQ==:117 a=OGiDJHazYrvzwCbh7ZIPzQ==:17 a=IkcTkHD0fZMA:10 a=MhDmnRu9jo8A:10 a=uGfl48vc2SFhAOzTW8YA:9 a=QEXdDO2ut3YA:10 Received: by llamedos.mydomain (Postfix, from userid 1000) id 39ED588628; Fri, 13 Aug 2021 03:05:37 +0100 (BST) Date: Fri, 13 Aug 2021 03:05:37 +0100 From: Ken Moffat To: freebsd-questions@freebsd.org Subject: Re: Applying patches to a folder Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Clacks-Overhead: GNU Terry Pratchett Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/2.1.1 (2021-07-12) X-CMAE-Envelope: MS4xfPGXdjHucsqhsgcJPpPA6MZlqgpdBi1IONWuzzDToprhQ9HIWo4I+iaj5Oa2Z9h1R9zgDlFkzbk2OZCvUmApxRwVrWvIt/LAr5F2kZwIj7Mcoutb6dRp /PT4F3MLqpFJHVdfqHvO3pO/0dk4bgeyPD18+5Bx4MVVp7rF//BeEpiNw2yCAEoEKUj69DafQAuQAGwG/ksARSA2GK+e4uBCDtE= X-Rspamd-Queue-Id: 4Gm6N94hhMz4cCg X-Spamd-Bar: -- X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[ntlworld.com:s=meg.feb2017]; HAS_XOIP(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:212.54.57.64/26]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[ntlworld.com:+]; DMARC_POLICY_ALLOW(-0.50)[ntlworld.com,quarantine]; RCVD_IN_DNSWL_NONE(0.00)[212.54.57.96:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RWL_MAILSPIKE_POSSIBLE(0.00)[212.54.57.96:from]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:33915, ipnet:212.54.48.0/20, country:NL]; MAILMAN_DEST(0.00)[freebsd-questions]; HAS_X_AS(0.00)[] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2021 02:05:46 -0000 On Tue, Aug 03, 2021 at 01:27:39PM -0400, Jonathan Moore wrote: > Hi, > > I have a few patches I would like to apply to a entire folder or directory > of source files > when I use bash to try to apply to a folder and I use the asterisk wildcard > I get an ambiguous redirect to resolve this issue. > > Thank You, > > Jonathan Since nobody has replied, I guess you've already found out that this is not how patches work. A patch changes something in a specific file to something else. If you are using a context diff to create the patch, it will typically apply even if the lines have moved (and report it applied with some fuzz). What you *can* do is: 1. Copy ALL the directory, call it 'a' or somename.orig. 2. Copy all of it again, call it 'b' or somename. 3. Change each file in 'b' or 'somename' as required. 4. Go up above this, diff the directories, e.g. diff -Naur a b >the-diff or diff -Naur somename{,orig,} >the-diff 5. You can then apply the-diff with patch -p1 to a future version of the directory, but eventually you will need to rediff when patches for one or more of the files no-longer apply. Alternatively, for some changes I guess sed might be the way to go - if so, make sure you have a copy of the directory before the sed, and diff them : the results of sed can often change more than was expected. ĸen -- Truth, in front of her huge walk-in wardrobe, selected black leather boots with stiletto heels for such a barefaced truth. - Unseen Academicals