Bug 160731 - /etc/profile has syntax error when used with korn shell (pdksh)
/etc/profile has syntax error when used with korn shell (pdksh)
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: setup (Show other bugs)
4
All Linux
medium Severity low
: ---
: ---
Assigned To: Bill Nottingham
David Lawrence
:
: 161433 171861 171945 173784 176265 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-06-16 17:55 EDT by Scott Lurndal
Modified: 2014-03-16 22:54 EDT (History)
6 users (show)

See Also:
Fixed In Version: 2.5.45-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-06-17 14:37:46 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Scott Lurndal 2005-06-16 17:55:03 EDT
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 17:58:23 EDT
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 17:59:43 EDT
EUID is used becasue id is in /usr/bin. Fixed in CVS, will be in future builds.
Comment 3 Scott Lurndal 2005-06-16 18:03:02 EDT
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 14:37:46 EDT
# 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 12:09:23 EDT
*** Bug 161433 has been marked as a duplicate of this bug. ***
Comment 6 Bill Nottingham 2005-10-27 13:16:46 EDT
*** Bug 171861 has been marked as a duplicate of this bug. ***
Comment 7 Bill Nottingham 2005-10-27 20:20:56 EDT
*** Bug 171945 has been marked as a duplicate of this bug. ***
Comment 8 Bill Nottingham 2005-11-21 12:20:30 EST
*** Bug 173784 has been marked as a duplicate of this bug. ***
Comment 9 Bill Nottingham 2005-12-20 13:51:14 EST
*** Bug 176265 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.