Re: intended MBF: wrong redirections in maintainer scripts

Adam Borowski wrote:
> On Tue, Aug 07, 2018 at 12:38:32PM +0200, Wouter Verhelst wrote:
>> On Sat, Aug 04, 2018 at 01:15:57PM +0800, Ralf Treinen wrote:
>> > as announced in our talk at debconf'18 [1] we intend a MBF about wrong
>> > redirections in maintainer scripts. In general these are of the form
>> >
>> > foo 2>&1 1> /dev/null
>> >
>> > Here it was probably intended to send both stderr and stdout to
>> > /dev/null.
>>
>> What makes you say that? ;-)
>>
>> It may be that the maintainer did indeed want stdout to be discarded,
>> but stderr not; for instance because they wanted to parse the stderr
>> output.
>>
>> (not saying this is the most likely case, but you might want to
>> double-check that before filing the bugs)
>
> Oy vey... I didn't notice this when Ralf's mail was posted (merely
> checked whether I'm or QA are on the dd-list). But, indeed, this whole
> MBF is wrong. Thanks Wouter!
Not wrong, just having the potential for false positives.
A cursory inspection using codesearch showed me 43 examples that where the
redirections are wrong and only 1 example where the script was actually
trying to capture stderr. (The code used by Ralf to find these picks up many
more examples than my simple grep will pick up.)
It may also be that Ralf and his team are already filtering out places where
the output is captured; the talk by Ralf and Nicholas at DebConf is well
worth watching.
https://debconf18.debconf.org/talks/90-mining-debian-maintainer-scripts/
Not restricting the search to maintainer scripts finds many many more...
it's a common enough mistake.
regards
Stuart
--
Stuart Prescott http://www.nanonanonano.net/ stuart@xxxxxxxxxxxxxxxx
Debian Developer http://www.debian.org/ stuart@xxxxxxxxxx
GPG fingerprint 90E2 D2C1 AD14 6A1B 7EBB 891D BBC1 7EBB 1396 F2F7