public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Torsten Bögershausen" <tboegi@web.de>,
	"SZEDER Gábor" <szeder.dev@gmail.com>,
	"Eric Sunshine" <sunshine@sunshineco.com>
Subject: Re: [PATCH v2] t: allow use of "sed -E"
Date: Thu, 12 Mar 2026 09:26:45 +0000	[thread overview]
Message-ID: <abKG1U3fVuNV1w_9@fruit.crustytoothpaste.net> (raw)
In-Reply-To: <xmqq3425lvtq.fsf@gitster.g>

[-- Attachment #1: Type: text/plain, Size: 2260 bytes --]

On 2026-03-12 at 00:45:21, Junio C Hamano wrote:
> Since early 2019 with e62e225f (test-lint: only use only sed [-n]
> [-e command] [-f command_file], 2019-01-20), we have been trying to
> limit the options of "sed" we use in our tests to "-e <pattern>",
> "-n", and "-f <file>".
> 
> Before the commit, we were trying to reject only "-i" (which is one
> of the really-not-portable options), but the commit explicitly
> wanted to reject use of "-E" (use ERE instead of BRE).  The commit
> cites the then-current POSIX.1 (Issue 7, 2018 edition) to show that
> "even recent POSIX does not have it!", but the latest edition (Issue
> 8) documents "-E" as an option to use ERE.
> 
> But that was 7 years ago, and that is a long time for many things to
> happen.

I think this seems reasonable.  I know this works on both reasonably
new Linux machines and on macOS, and I did some spot checking with the
FreeBSD manual page viewer[0] and it's present in the following:

* at least FreeBSD 9.0 (current is 15.0)
* at least NetBSD 7.0 (current is 10.1)
* at least OpenBSD 6.0 (current is 7.8)
* Ubuntu 18.04

so this appears to be reasonably well supported across major open source
distributions.  The irony is that Linux is most likely the OS holding us
back here, since older versions labeled this `-r` and the newer `-E`
wasn't available in Ubuntu 16.04.  I myself only recently learned about
the fact that `-E` had been officially standardized, since I'd been
using `-r` for a long time.

And, for the record, I agree with you that `-i` is totally non-portable
because it _requires_ an argument on BSD sed and the argument is
optional on GNU sed (and cannot be specified as '').  I have a testsuite
at work where I gave up and just used `perl -i` instead.

> Besides, we have been using "sed -E" without the check in question
> triggering in one of the scripts since 2022, with 461fec41 (bisect
> run: keep some of the post-v2.30.0 output, 2022-11-10).  It was
> hidden because the 'E' was squished with another single letter
> option.

Yes, I think if nobody has complained about it in three years, we should
be fine.

[0] https://man.freebsd.org/cgi/man.cgi
-- 
brian m. carlson (they/them)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

  parent reply	other threads:[~2026-03-12  9:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11 21:35 [RFC] t: allow use of "sed -E" Junio C Hamano
2026-03-11 21:41 ` Junio C Hamano
2026-03-11 23:12   ` Ramsay Jones
2026-03-12  0:33     ` Junio C Hamano
2026-03-12  0:45 ` [PATCH v2] " Junio C Hamano
2026-03-12  6:41   ` Patrick Steinhardt
2026-03-12  9:26   ` brian m. carlson [this message]
2026-03-12 13:43     ` Junio C Hamano
2026-03-14 23:16     ` Todd Zullinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=abKG1U3fVuNV1w_9@fruit.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sunshine@sunshineco.com \
    --cc=szeder.dev@gmail.com \
    --cc=tboegi@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox