Bug 160731

Summary: /etc/profile has syntax error when used with korn shell (pdksh)
Product: [Fedora] Fedora Reporter: Scott Lurndal <scott>
Component: setupAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: low Docs Contact:
Priority: medium    
Version: 4CC: anton, deknuydt, game29, rory.lampert, rvokal, sfalco
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 2.5.45-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-06-17 18:37:46 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:

Description Scott Lurndal 2005-06-16 21:55:03 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

Description of problem:
When logging in using pdksh as the login shell, the following (benign) error
is generated:
/etc/profile[17]: [: argument expected

Line 17 in /etc/profile:

  if [ $EUID = 0 ]; then
   ...
  fi

While both Bash and PDKSH use /etc/profile at login, only bash provides
an EUID environment variable.   The if statement on line 17 should be changed
to 
  if [ "$EUID" = "0" ]; then
    ...
  fi 


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

How reproducible:
Always

Steps to Reproduce:
1.specify the korn shell (pdksh) as login shell
2.login
3.see error
  

Actual Results:  /etc/profile[17]: [: argument expected

Additional info:

Comment 1 Scott Lurndal 2005-06-16 21:58:23 UTC
Alternatively, you could change this back to the version used in FC3 which
invoked the 'id' command to determine the effective UID of the current
process.   Note that the backtick method of invoking commands from shell scripts
has been deprecated for quite some time in favor of $(cmd).  For example, 
instead of `id -u`, one should use $(id -u) in bourne/korn/bourneagain scripts.

Comment 2 Bill Nottingham 2005-06-16 21:59:43 UTC
EUID is used becasue id is in /usr/bin. Fixed in CVS, will be in future builds.

Comment 3 Scott Lurndal 2005-06-16 22:03:02 UTC
If someone (as I usually do) uses usermod(1m) to change the root shell from bash
to ksh, then the PATH will not include the sbin directories on root logins.  
You cannot correctly rely on EUID in this case.

Comment 4 Bill Nottingham 2005-06-17 18:37:46 UTC
# ksh workaround
if [ -z "$EUID" -a -x /usr/bin/id ]; then
       EUID=`id -u`
       UID=`id -ru`
fi

added in 2.5.45-1.


Comment 5 Bill Nottingham 2005-06-23 16:09:23 UTC
*** Bug 161433 has been marked as a duplicate of this bug. ***

Comment 6 Bill Nottingham 2005-10-27 17:16:46 UTC
*** Bug 171861 has been marked as a duplicate of this bug. ***

Comment 7 Bill Nottingham 2005-10-28 00:20:56 UTC
*** Bug 171945 has been marked as a duplicate of this bug. ***

Comment 8 Bill Nottingham 2005-11-21 17:20:30 UTC
*** Bug 173784 has been marked as a duplicate of this bug. ***

Comment 9 Bill Nottingham 2005-12-20 18:51:14 UTC
*** Bug 176265 has been marked as a duplicate of this bug. ***