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 1721048 - Regression in ksh introduced by 820192
Summary: Regression in ksh introduced by 820192
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: bash
Version: ---
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: 8.0
Assignee: Siteshwar Vashisht
QA Contact: Karel Volný
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-06-17 08:13 UTC by Renaud Métrich
Modified: 2019-06-18 15:00 UTC (History)
0 users

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-06-18 13:52:33 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Renaud Métrich 2019-06-17 08:13:33 UTC
Description of problem:

BZ #820192 introduced a regression when executing ksh compared to RHEL 6 (regression exists since RHEL 7):

# ksh cd /opt
builtin: /opt: not found

This is due to having a "/usr/bin/cd" executable since RHLE7 and that executable being a bash script using the "builtin" command which has a different semantic in bash and ksh.


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




How reproducible:

Always


Steps to Reproduce:
1. Execute ksh with "cd" argument

  # ksh cd /opt

Actual results:

builtin: /opt: not found


Expected results:

Nothing


Additional info:

This affects other commands as well: alias bg cd command fc fg getopts jobs read umask unalias wait.
IMHO the code in /usr/bin/cd and other commands, created in bash.spec directly, should be made compatible with ksh.

Comment 1 Siteshwar Vashisht 2019-06-18 13:52:33 UTC
`builtin` command works differently in bash and ksh. In bash it executes the builtin and in ksh it enables a builtin of the name that is passed as argument. Fixing this issue requires changing behavior of `buitlin` command in ksh, but it can not be done to retain backward compatiblity.

Comment 2 Renaud Métrich 2019-06-18 14:16:37 UTC
Another way of fixing this is to detect whether ksh is used using $SHELL and not redirect to "builtin" in that case.

Comment 3 Siteshwar Vashisht 2019-06-18 14:27:01 UTC
You are right, but I would prefer to leave this as a limitation rather then trying to workaround a solution for every possible shell. These scripts should have never been added at first place.

Comment 4 Renaud Métrich 2019-06-18 14:29:14 UTC
Current /usr/bin/cd:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
#!/bin/sh
builtin cd "$@"
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Proposed /usr/bin/cd (and the like in /usr/bin):
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
#!/bin/sh
[ -z "$KSH_VERSION" ] && builtin cd "$@" || cd "$@"
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Please re-evaluate.

Comment 5 Siteshwar Vashisht 2019-06-18 15:00:50 UTC
Your script works around this bug, but it assumes `builtin` keyword works same way in every other shell than ksh. `builtin` keyword is not defined by posix, so it's behavior may vary across shells, so this script may break again with other shells.


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