Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 743564

Summary: ksh fails to process alias (echo='echo -e')
Product: Red Hat Enterprise Linux 6 Reporter: Nikhil AR <nalayil>
Component: kshAssignee: Michal Hlavinka <mhlavink>
Status: CLOSED NOTABUG QA Contact: qe-baseos-tools-bugs
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: mfranc, nalayil, prc, rpiddapa
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-11-07 12:30:50 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 Nikhil AR 2011-10-05 11:48:06 UTC
Description of problem:
ksh fails to process alias (echo='echo -e') in ksh-20100621-6.el6.x86_64


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


How reproducible:
Always


Steps to Reproduce: ksh kshTest.ksh

****************************************************
# cat kshTest.ksh 

#!/bin/ksh

. kshTestI.ksh

typeset -ft hugo

hugo "Install Apache Xerces (C++/Perl)" 

echo "\n\n Hello My dear Friend \n"

**************************************************
# cat kshTestI.ksh

#!/bin/ksh

alias echo='echo -e'

hugo() {
  alias echo
  echo "\n\n  ==== ${0##*/}: $1 ====\n" 
}

*************************************************
Actual results:

echo='echo -e'
\n\n  ==== kshTest.ksh: Install Apache Xerces (C++/Perl) ====\n


 Hello My dear Friend 


Expected results:

echo='echo -e'


 ==== kshTest.ksh: Install Apache Xerces (C++/Perl) ====



 Hello My dear Friend 

Additional info:

Issue is always reproducible in f15 ksh(ksh-20110630-3.fc15.x86_64) as well.

Customer says, the same works successfully in OpenSuSE 11.4 ksh(ksh-93t-176.2.x86_64). I think the sneaky guys at SuSE didn't pulled the patch upstream.

Comment 2 Michal Hlavinka 2011-11-04 12:30:02 UTC
This is how it's designed to work.

man page:

aliases: Aliasing is performed when scripts are read, not while they are executed. Therefore, for an alias to take effect, the alias definition command has to be executed before the command which references the alias is read.

. name: Otherwise if name refers to a file, the file is read in its entirety and the commands are executed in the current shell environment.


And confirmed from upstream:
=========================================================
this is documented behavior.  aliases are expanded when reading
a script and a dot script is read in its entirety before running
any commands.  Therefore, any aliases defined in a . script (or function)
will not take effect for that dot script or function.

However, profile files are read an processed one command at a time unlike
dot scripts.
=========================================================

so this is a wontfix