Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o, Michael 'veremitz' Everitt <gentoo@×××××××.xyz>
Subject: Re: [gentoo-portage-dev] Re: RFC: [QA] notice with 'failed' seds [was PATCH: eapply drop -s option]
Date: Mon, 16 Dec 2019 08:27:25
Message-Id: ff3a8c52e7381dc22afb7b063f29e44946ac72dc.camel@gentoo.org
In Reply to: [gentoo-portage-dev] Re: RFC: [QA] notice with 'failed' seds [was PATCH: eapply drop -s option] by Zac Medico
1 On Sun, 2019-12-15 at 13:29 -0800, Zac Medico wrote:
2 > On 12/13/19 2:12 PM, Michael 'veremitz' Everitt wrote:
3 > > On 13/12/19 20:36, Michał Górny wrote [excerpted]:
4 > > > Is this really an argument for or *against* it? Developers are entirely
5 > > > capable of keeping seds that do nothing for years, as well as patches
6 > > > that -- while apparently applying correctly -- are entirely meaningless.
7 > > <snip>
8 > >
9 > > I think there is some merit in some kind of feedback when sed's are doing
10 > > nothing, although how feasible it is to generate any useful feedback I
11 > > can't say. I wouldn't say it needs to explicitly fail or make lots of
12 > > noise, just an info message that could prompt some further investigation.
13 > >
14 >
15 > It's possible to implement a sed wrapper that detects file arguments for
16 > -i/--in-place mode, and compares file content before and after the sed call.
17 >
18 > There are also ways to make sed exit with an error but that won't be as
19 > easy to use as a sed wrapper:
20 >
21 > https://stackoverflow.com/questions/15965073/return-code-of-sed-for-no-match/15966279
22
23 Don't forget that there could be valid cases for sed not changing
24 a file. Not to mention corner cases where a working replacement results
25 in no change, e.g.:
26
27 # yuck!
28 sed -i -e "s^-O2^${CFLAGS}^" ...
29
30 --
31 Best regards,
32 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies