Bug 163637

Summary: /etc/profile assumes there is an EUID variable
Product: [Fedora] Fedora Reporter: Paul Watson <pwatson>
Component: setupAssignee: Karsten Hopp <karsten>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4CC: jgowland, k.georgiou, sfalco
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-10-19 12:20:36 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 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):
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 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`
fi



Comment 7 Bill Nottingham 2005-12-20 18:50:16 UTC
*** Bug 176265 has been marked as a duplicate of this bug. ***