Bug 160731 - /etc/profile has syntax error when used with korn shell (pdksh)
Summary: /etc/profile has syntax error when used with korn shell (pdksh)
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: setup
Version: 4
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: David Lawrence
URL:
Whiteboard:
: 161433 171861 171945 173784 176265 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-06-16 21:55 UTC by Scott Lurndal
Modified: 2014-03-17 02:54 UTC (History)
6 users (show)

Fixed In Version: 2.5.45-1
Clone Of:
Environment:
Last Closed: 2005-06-17 18:37:46 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

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. ***


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