NetBSD Problem Report #59639
From www@netbsd.org Sun Sep 7 18:53:05 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits)
client-signature RSA-PSS (2048 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 412351A923D
for <gnats-bugs@gnats.NetBSD.org>; Sun, 7 Sep 2025 18:53:05 +0000 (UTC)
Message-Id: <20250907185304.361291A923E@mollari.NetBSD.org>
Date: Sun, 7 Sep 2025 18:53:04 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: sed(1) man page is wrong about case-insensitivity flag
X-Send-Pr-Version: www-1.0
>Number: 59639
>Category: bin
>Synopsis: sed(1) man page is wrong about case-insensitivity flag
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bad
>State: needs-pullups
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Sep 07 18:55:00 +0000 2025
>Closed-Date:
>Last-Modified: Mon Sep 08 01:04:46 +0000 2025
>Originator: Taylor R Campbell
>Release: 9
>Organization:
thE netBSeD fOuNDAtIoN
>Environment:
>Description:
The sed man page says:
> Sed Addresses
> An address is not required, but if specified must have one of the
> following formats:
> ...
> o a context address that consists of a regular expression
> preceded and followed by a delimiter. The closing delimiter
> can also optionally be followed by the "i" character, to
> indicate that the regular expression is to be matched in a
> case-insensitive way.
But:
$ echo foo | sed -e /foo/d
$ echo Foo | sed -e /foo/d
Foo
$ echo Foo | sed -e /foo/id
sed: 1: "/foo/id
": command i expects \ followed by text
$ echo Foo | sed -e /foo/di
sed: 1: "/foo/di
": extra characters at the end of d command
It turns out the flag is I (uppercase), not i (lowercase):
$ echo Foo | sed -e /foo/Id
$ { echo Foo; echo bar; } | sed -e /foo/Id
bar
>How-To-Repeat:
As shown above.
>Fix:
Yes, please!
>Release-Note:
>Audit-Trail:
From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/59639: sed(1) man page is wrong about case-insensitivity flag
Date: Mon, 8 Sep 2025 02:02:44 +0300
> $ echo Foo | sed -e /foo/id
> sed: 1: "/foo/id
> ": command i expects \ followed by text
As GNU sed manual points out, it uses 'I', not 'i', b/c GNU sed
supports alternative syntax for 'i' where the text to be added follows
after 'i' on the same line:
In many other programming languages, a lower case 'i' is used for
case-insensitive regular expression matching. However, in 'sed'
the 'i' is used for the insert command (*note insert command::).
...
$ printf "%s\n" a b c | sed '/b/id'
a
d
b
c
That's probably worth a mention in the new, fixed text.
-uwe
State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Mon, 08 Sep 2025 01:03:38 +0000
State-Changed-Why:
fixed in HEAD (though should maybe have explanation added like uwe suggests)
needs pullup-11, pullup-10, pullup-9
Responsible-Changed-From-To: bin-bug-people->bad
Responsible-Changed-By: riastradh@NetBSD.org
Responsible-Changed-When: Mon, 08 Sep 2025 01:04:46 +0000
Responsible-Changed-Why:
fixed by bad@ in the following commit:
https://mail-index.netbsd.org/source-changes/2025/06/19/msg157244.html
Module Name: src
Committed By: bad
Date: Thu Jun 19 12:31:11 UTC 2025
Modified Files:
src/usr.bin/sed: sed.1
Log Message:
sed.1: must use capital 'I' to make address RE ignore case
While here, remove a doubled space added in the previous commit.
Ride the date bump of the previous commit.
To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/sed/sed.1
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.