From owner-freebsd-questions@freebsd.org Tue Mar 9 15:15:16 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 198F855574A for ; Tue, 9 Mar 2021 15:15:16 +0000 (UTC) (envelope-from news@mips.inka.de) Received: from mail.inka.de (mail.inka.de [IPv6:2a04:c9c7:0:1073:217:a4ff:fe3b:e77c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DvzKb25NSz4YPd for ; Tue, 9 Mar 2021 15:15:14 +0000 (UTC) (envelope-from news@mips.inka.de) Received: from mips.inka.de (news@[127.0.0.1]) by mail.inka.de with uucp (rmailwrap 0.5) id 1lJe4f-008Wdo-SC; Tue, 09 Mar 2021 16:15:05 +0100 Received: from lorvorc.mips.inka.de (localhost [127.0.0.1]) by lorvorc.mips.inka.de (8.16.1/8.16.1) with ESMTP id 129FBjWY089666 for ; Tue, 9 Mar 2021 16:11:45 +0100 (CET) (envelope-from news@lorvorc.mips.inka.de) Received: (from news@localhost) by lorvorc.mips.inka.de (8.16.1/8.16.1/Submit) id 129FBjwN089665 for freebsd-questions@freebsd.org; Tue, 9 Mar 2021 16:11:45 +0100 (CET) (envelope-from news) To: freebsd-questions@freebsd.org From: Christian Weisgerber Newsgroups: list.freebsd.questions Subject: Re: sed -i empty argument compatibility issue Date: Tue, 9 Mar 2021 15:11:45 -0000 (UTC) Message-ID: References: <9178f6c5-631a-c2c2-c6b1-8def94a3397b@dreamchaser.org> <20210305142352297368817@bob.proulx.com> User-Agent: slrn/1.0.3 (FreeBSD) X-Rspamd-Queue-Id: 4DvzKb25NSz4YPd X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of news@mips.inka.de has no SPF policy when checking 2a04:c9c7:0:1073:217:a4ff:fe3b:e77c) smtp.mailfrom=news@mips.inka.de X-Spamd-Result: default: False [0.20 / 15.00]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; FREEFALL_USER(0.00)[news]; FROM_HAS_DN(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a04:c9c7:0:1073:217:a4ff:fe3b:e77c:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; TO_DN_NONE(0.00)[]; AUTH_NA(1.00)[]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[2a04:c9c7:0:1073:217:a4ff:fe3b:e77c:from:127.0.2.255]; RCVD_COUNT_THREE(0.00)[3]; DMARC_NA(0.00)[inka.de]; NEURAL_SPAM_SHORT(1.00)[0.995]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[naddy@mips.inka.de,news@mips.inka.de]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:202113, ipnet:2a04:c9c7::/32, country:DE]; FROM_NEQ_ENVFROM(0.00)[naddy@mips.inka.de,news@mips.inka.de]; 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 15:15:16 -0000 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 -- Christian "naddy" Weisgerber naddy@mips.inka.de