Gentoo Archives: gentoo-dev

From: Anna V <cyber+gentoo@×××××.in>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH 0/2] Add esed.eclass for sed that dies if caused no changes
Date: Fri, 03 Jun 2022 04:48:00
Message-Id: YpmSd6RYGfEjtSqt@sysrq.in
In Reply to: Re: [gentoo-dev] [PATCH 0/2] Add esed.eclass for sed that dies if caused no changes by Ionen Wolkens
1 On 2022-06-03 00:45, Ionen Wolkens wrote:
2 > On Fri, Jun 03, 2022 at 06:09:38AM +0200, Michał Górny wrote:
3 > > On Tue, 2022-05-31 at 07:23 -0400, Ionen Wolkens wrote:
4 > > > Often preferable to use patches so this happens, but sed have its
5 > > > uses/convenience and this intend to help reduce the amount of old
6 > > > broken seds causing issues that go unnoticed on bumps.
7 > > >
8 > > > Inspired by app-portage/iwdevtools' qa-sed (warns on any seds), but
9 > > > this is for more deterministic use in ebuilds.
10 > > >
11 > > > Also slightly shortens sed use, -i is default, and no need to || die.
12 > > > (see @EXAMPLE in eclass for a quick usage overview).
13 > > >
14 > >
15 > > To be honest, I strongly dislike this. It really feels like trying to
16 > > make an adapter for a square wheel, while the right solution would be to
17 > > replace the wheel. On top of that, ton of evals which are pretty much
18 > > a huge "no-no".
19 >
20 > About evals, the two eval is just to silence this:
21 >
22 > var=$(printf "\0")
23
24 printf -v var "\0"
25
26 > The 2>/dev/null doesn't work without wrapping it, aka
27 >
28 > eval 'var=$(printf "\0")' 2>/dev/null
29 >
30 > No variables are expanded pre-eval so it's just evaluating a
31 > static statement. eval can be removed, but it'll be noisy
32 > if someone happens to sed binary files.
33 >
34 > >
35 > > Perhaps it would be better to forget about trying to work miracles with
36 > > sed and instead write a trivial shell replacement for the most common
37 > > use cases. One thing I'd love to see is a simple substitution command
38 > > that would work for paths/CFLAGS on RHS without having to worry about
39 > > them conflicting with the pattern delimiter.
40 > >
41 > > --
42 > > Best regards,
43 > > Michał Górny
44 > >
45 > >
46 >
47 > --
48 > ionen

Replies