From owner-freebsd-questions@freebsd.org Tue Mar 9 17:11:56 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 9026256A0ED for ; Tue, 9 Mar 2021 17:11:56 +0000 (UTC) (envelope-from freebsd@dreamchaser.org) Received: from nightmare.dreamchaser.org (ns.dreamchaser.org [66.109.141.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "dreamchaser.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dw1wC54bTz4j7T for ; Tue, 9 Mar 2021 17:11:55 +0000 (UTC) (envelope-from freebsd@dreamchaser.org) Received: from breakaway.dreamchaser.org (breakaway [192.168.151.122]) by nightmare.dreamchaser.org (8.15.2/8.15.2) with ESMTP id 129HBl9R005602; Tue, 9 Mar 2021 10:11:47 -0700 (MST) (envelope-from freebsd@dreamchaser.org) Subject: Re: sed -i empty argument compatibility issue To: Christian Weisgerber , freebsd-questions@freebsd.org References: <9178f6c5-631a-c2c2-c6b1-8def94a3397b@dreamchaser.org> <20210305142352297368817@bob.proulx.com> Reply-To: freebsd@dreamchaser.org From: Gary Aitken Message-ID: Date: Tue, 9 Mar 2021 10:06:44 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (nightmare.dreamchaser.org [192.168.151.101]); Tue, 09 Mar 2021 10:11:47 -0700 (MST) X-Rspamd-Queue-Id: 4Dw1wC54bTz4j7T X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd@dreamchaser.org designates 66.109.141.57 as permitted sender) smtp.mailfrom=freebsd@dreamchaser.org X-Spamd-Result: default: False [-3.30 / 15.00]; HAS_REPLYTO(0.00)[freebsd@dreamchaser.org]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[66.109.141.57:from]; DMARC_NA(0.00)[dreamchaser.org]; SPAMHAUS_ZRD(0.00)[66.109.141.57:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:21947, ipnet:66.109.128.0/19, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-questions] 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: Tue, 09 Mar 2021 17:11:56 -0000 On 3/9/21 8:11 AM, Christian Weisgerber wrote: > On 2021-03-05, Bob Proulx wrote: > >> 4. Introduce a "sed" wrapper in PATH that intercepts the call to the >> real sed, detects this problematic usage case, and then DTRT does the >> right thing with it. > > To save a lot of patching for the regression tests in the devel/got > port, I added this shell function: > > # compat wrapper > sed() > ( > for i; do > arg=$1 > shift > case $arg in > -i) set - "$@" "$arg" '' ;; > *) set - "$@" "$arg" ;; > esac > done > exec sed "$@" > ) > > No, it doesn't handle all cases, but it is good enough in that context. > ports/devel/got/files/patch-regress_cmdline_common.sh In my case, the folks maintaining the package (FreeCAD) were more than happy to fix the source of the problem to conform to POSIX and not use -i, but rather write a temp file and mv it. So with the next release it will "just work". Gary