Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 163637 - /etc/profile assumes there is an EUID variable
Summary: /etc/profile assumes there is an EUID variable
Alias: None
Product: Fedora
Classification: Fedora
Component: setup
Version: 4
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Karsten Hopp
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2005-07-19 18:52 UTC by Paul Watson
Modified: 2007-11-30 22:11 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-10-19 12:20:36 UTC

Attachments (Terms of Use)

Description Paul Watson 2005-07-19 18:52:58 UTC
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):

How reproducible:

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

Additional info:

Comment 1 Peter Seebach 2005-10-11 10:47:22 UTC
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 17:59:32 UTC
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 18:16:24 UTC
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 18:27:42 UTC
Why not just go back to using what works; 'id -u', and be done with it?

Comment 5 Paul Watson 2005-10-17 11:53:06 UTC
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 12:20:36 UTC
/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`

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