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 2050996 - CentOS 9 Stream: export -f from /etc/profile not supported when using ksh as login shell
Summary: CentOS 9 Stream: export -f from /etc/profile not supported when using ksh as ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: which
Version: CentOS Stream
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: 9.1
Assignee: Than Ngo
QA Contact: Jakub Haruda
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-05 16:29 UTC by Stefan Krüger
Modified: 2022-11-15 13:03 UTC (History)
4 users (show)

Fixed In Version: which-2.21-28.el9
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-15 11:16:07 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-111233 0 None None None 2022-02-05 16:33:53 UTC
Red Hat Product Errata RHBA-2022:8305 0 None None None 2022-11-15 11:16:08 UTC

Description Stefan Krüger 2022-02-05 16:29:38 UTC
Description of problem:

The following error is shown on login when using ksh as the default shell:

```
/etc/profile[61]: .[293]: export: -f: unknown option
Usage: export [-p] [name[=value]...]
 Help: export [ --help | --man ] 2>&1
```

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

setup-2.13.7-6.el9.noarch
ksh-1.0.0~beta.1-2.el9.x86_64

How reproducible:

happens every time

Steps to Reproduce:
1. sudo dnf -y install ksh
2. sudo usermod -s /bin/ksh93 $(whoami)
3. logout and login again

Actual results:

see above

Expected results:

no "export -f" error, /etc/profile that works with ksh

Additional info:

Comment 1 Stefan Krüger 2022-03-21 20:08:37 UTC
The root cause is `/etc/profile.d/which2.sh` from package `which-2.21-27.el9.x86_64`:


```bash
[...]
which_opt="-f" # <--
which_shell="$(cat /proc/$$/comm)" # <-- yields ksh93 for ksh93 shell

if [ "$which_shell" = "ksh" ] || [ "$which_shell" = "mksh" ] || [ "$which_shell" = "zsh" ] ; then # "ksh" != "ksh93"
  which_declare="typeset -f"
  which_opt=""
fi

which ()
{
(alias; eval ${which_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot "$@"
}

export which_declare
export ${which_opt} which
```

I guess the fix would be adding `|| [ "$which_shell" = "ksh93" ]`.

Comment 3 Than Ngo 2022-05-09 12:42:23 UTC
it is fixed in which-2.21-28.el9

Comment 8 errata-xmlrpc 2022-11-15 11:16:07 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (which bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:8305


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