Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 328503 - linux-mod.eclass causing warning 'sed' called in global scope
Summary: linux-mod.eclass causing warning 'sed' called in global scope
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-15 23:14 UTC by email200202
Modified: 2016-12-23 21:13 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description email200202 2010-07-15 23:14:05 UTC
During emerge, I got the warning 'sed' called in global scope for packages using linux-mod.eclass.

Reproducible: Always

Steps to Reproduce:
1. emerge --sync
2. emerge -avuDN world

Actual Results:  
If you have packages using linux-mod.eclass, you get the above warning.


Expected Results:  
No warnings.

linux-mod.eclass is calling 'sed' at two lines:
sed -i 's:SUBDIRS=:M=:g' "${1}"
sed -i -e "/.*${CATEGORY}\/${PN}-${PVR}.*/d"

This is not in agreement with Gentoo Ebuild policy (http://www.gentoo.org/proj/en/devrel/handbook/handbook.xml?part=3&chap=1):
"An external application (such as grep, sed or awk) should never be called in global
scope for performance reasons, and alternatives such as using built-in bash
replacement should be used instead. Useful alternatives can be found in the Advanced
Bash Scripting Guide."
Comment 1 Mike Pagano gentoo-dev 2014-01-09 19:29:46 UTC
That line in the handbook actually refers to the ebuild policy.  sed is used ~122 times in all of our eclasses. I don't see this as a policy violation.
Comment 2 Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2014-01-09 19:56:38 UTC
[QA]

They are inside a function; so, the eclass itself has no guarantee for it to be ran in global scope. If you however find an ebuild that calls these functions in global scope, feel free to let us know.
Comment 3 Mike Pagano gentoo-dev 2014-01-14 20:51:03 UTC
+  14 Jan 2014; Michael Pagano <mpagano@gentoo.org> linux-mod.eclass:
+  Remove use of sed in linux-mod.eclass. Replace with bash.
+
Comment 4 Mike Pagano gentoo-dev 2014-01-14 20:51:49 UTC
Missed the second spot. I will look at this next.
Comment 5 Mike Pagano gentoo-dev 2016-12-23 21:13:33 UTC
sed not called in global scope