Bug 152143

Summary: Logging in on a loaded machne slows because of slow egrep in pathmunge function of /etc/profile
Product: Red Hat Enterprise Linux 3 Reporter: Stoyan Genov <stoyan.genov>
Component: setupAssignee: Bill Nottingham <notting>
Status: CLOSED WONTFIX QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: redhat-bugzilla, rvokal, shillman
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-03-28 20:22:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 152351    

Description Stoyan Genov 2005-03-25 10:28:36 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; OpenBSD i386; en-US; rv:1.6) Gecko/20041029 Firefox/0.8

Description of problem:
When a machine is loaded (high I/O, a lot of processes), logins to it are further delayed because /etc/profile is parsed upon login, and in the pathmunge() function there, it takes a lot of time to exec egrep command

Version-Release number of selected component (if applicable):
setup-2.5.27-1

How reproducible:
Sometimes

Steps to Reproduce:
1. Load a machine (load above 10 on a 2xXeon/2.8Ghz with 15+% I/O wait)
2. Login (console or ssh) with pathmunge calls enabled in /etc/profile
3. Login (console or ssh) with pathmunge calls commented out in /etc/profile
4. Profile time of parsing of /etc/profile via ``date'' in beginning, before first pathmunge(), after last pathmunge(), at end of file

Actual Results:  99% of the time /etc/profile is executing egrep's, which delays login time significantly

Expected Results:  Change pathmunge() function to use internal variable pattern matching functions

Additional info:

pathmunge () {
        if [ X"$PATH" == X"${PATH//:$1}" -a  \
             X"$PATH" == X"${PATH//$1:}" ]; then
                [ X"$2" != X"after" ] && PATH=$1:$PATH || PATH=$PATH:$1
        fi
}

Comment 1 Suzanne Hillman 2005-03-28 19:31:48 UTC
Internal RFE bug #152351 opened; will be considered for future releases.

Comment 2 Bill Nottingham 2005-03-28 20:22:08 UTC
Uses bash-specific syntax in a file sourced by non-bash shells.