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 2035863

Summary: KSH script execution fails with sort: cannot execute [Exec format error]
Product: Red Hat Enterprise Linux 8 Reporter: Jing Huo <jhuo>
Component: kshAssignee: Vincent Mihalkovič <vmihalko>
Status: CLOSED DUPLICATE QA Contact: Karel Volný <kvolny>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.5CC: amepatil, kdudka, kvolny, rdulhani, vmihalko
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: ksh-20120801-255.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1857847 Environment:
Last Closed: 2022-05-30 08:41:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1857847    
Bug Blocks:    

Description Jing Huo 2021-12-28 06:49:21 UTC
Description of problem:

KSH script execution fails with “sort: sort: cannot execute [Exec format error]”

$ find . | sort > /work/$(date +%Y%m%d)_$(date +%Y%m%d)
sort: sort: cannot execute [Exec format error]

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

RHEL 8.5
ksh-20120801-254.el8.x86_64

How reproducible:

RHEL 8.5
==========

Steps to Reproduce:
1. Make sure user has permission to write in /work
2. Start ksh session
$ ksh
3. Run the command:
$ find . | sort > /work/$(date +%Y%m%d)_$(date +%Y%m%d)

Actual results:

$ find . | sort > /work/$(date +%Y%m%d)_$(date +%Y%m%d)
sort: sort: cannot execute [Exec format error]

Expected results:
no error output

Additional info: 

change the command to the following, sometimes works, sometimes not.

$ find . | sort > /work/$(date +%Y%m%d)_20211228

~~~
$ find . | sort > /work/$(date +%Y%m%d)_20211228
sort: sort: cannot execute [Exec format error]
$ find . | sort > /work/$(date +%Y%m%d)_20211228
$ find . | sort > /work/$(date +%Y%m%d)_20211228
$ find . | sort > /work/$(date +%Y%m%d)_20211228
sort: sort: cannot execute [Exec format error]
~~~

Workaround:

$ today=$(date +%Y%m%d)_$(date +%Y%m%d)
$ find . | sort > /work/$today

Comment 2 Vincent Mihalkovič 2022-03-08 14:59:16 UTC
Fix for this is same as in: https://bugzilla.redhat.com/show_bug.cgi?id=1857847.

Upstream commit: https://github.com/ksh93/ksh/commit/f207cd57.

Comment 4 Karel Volný 2022-05-24 11:28:53 UTC
ahem, shouldn't this be marked as duplicate of #1857847 ?

Comment 5 Kamil Dudka 2022-05-24 11:52:51 UTC
I think so.  Both the bugs refer to the same upstream fix.

Comment 6 Vincent Mihalkovič 2022-05-30 08:41:35 UTC

*** This bug has been marked as a duplicate of bug 1857847 ***