Gentoo Archives: gentoo-portage-dev

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

Attachments

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