This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 163637 - /etc/profile assumes there is an EUID variable
/etc/profile assumes there is an EUID variable
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: setup (Show other bugs)
4
All Linux
medium Severity medium
: ---
: ---
Assigned To: Karsten Hopp
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-07-19 14:52 EDT by Paul Watson
Modified: 2007-11-30 17:11 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-10-19 08:20:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Paul Watson 2005-07-19 14:52:58 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Fedora/1.0.4-1.3.1 Firefox/1.0.4

Description of problem:
When starting a shell with ksh, an error message appears for line 17 because there is no EUID variable.  The bash shell produces an EUID variable.

This is not a bug in ksh.  Please reassign it as appropriate.

FC3 /etc/profile used `id -u` rather than EUID.  Why did this change?

Version-Release number of selected component (if applicable):
ksh-20050202-1

How reproducible:
Always

Steps to Reproduce:
1. set /bin/ksh as the user's shell
2. logout and login as the user
3. start a shell
4. use Edit/Current Profile.../Title and Command tab and select Run command as login shell
5. logout and login as the user
6. start a shell
  

Actual Results:  Error message appears before user prompt is available.

/etc/profile[17]: [: argument expected
/usr/bin/vim

Additional info:
Comment 1 Peter Seebach 2005-10-11 06:47:22 EDT
Presumably this changed because referencing $EUID is faster (no fork/exec).

Perhaps it should use

if [ ${EUID:-unset} = 0 ]

which is portable to any Bourne shell or derivative of the last decade or two.
Comment 2 Michael Carney 2005-10-16 13:59:32 EDT
It changed because FC4 is now including the "real" korn shell from AT&T, rather
than pdksh. KSH 93 doesn't set EUID, hence the problem. The real question is why
/etc/profile was changed from id -u in FC3 and earlier to the use of $EUID in FC4.

Sure, it's more efficient (no exec of id), but if it doesn't work...
Comment 3 Michael Carney 2005-10-16 14:16:24 EDT
Since KSH 93 is owned by others, changing it to set EUID is probably not going to
happen. However, we could change login(1) to set EUID, although that would require
changing bash, zsh, etc to *not* set EUID, and remove mentioning it from their
man pages, and add setting it to login(1).
Comment 4 Paul Watson 2005-10-16 14:27:42 EDT
Why not just go back to using what works; 'id -u', and be done with it?
Comment 5 Paul Watson 2005-10-17 07:53:06 EDT
How about something like the following?  Perhaps it needs some revision to work
with older shells.

if [[ "${EUID}" = "0" || $(id -u) = 0 ]]

This would use the EUID if it exists and invoke 'id' if not.
Comment 6 Karsten Hopp 2005-10-19 08:20:36 EDT
/etc/profile belongs to the setup package.
The current rawhide version has the following workaround:
# ksh workaround
if [ -z "$EUID" -a -x /usr/bin/id ]; then
    EUID=`id -u`
    UID=`id -ru`
fi

Comment 7 Bill Nottingham 2005-12-20 13:50:16 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.