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 1491312 - obscure bugs with select
Summary: obscure bugs with select
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: mksh
Version: 7.4
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Michal Hlavinka
QA Contact: Jan Kepler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-13 13:46 UTC by jbmorris
Modified: 2018-04-10 17:44 UTC (History)
1 user (show)

Fixed In Version: mksh-46-7.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 17:44:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0951 0 None None None 2018-04-10 17:44:35 UTC

Description jbmorris 2017-09-13 13:46:42 UTC
Description of problem:
There appear to be two bugs with select in mksh on RedHat 7, neither of which happen in ksh93 or bash, nor do they happen with mksh on RedHat 6.

1. Per the mksh man page: "name is set to the selected word (or unset if the selection is not valid)". However, we are finding that it is NOT getting unset if the selection is invalid and non-numeric. Consider this:

 select var in a b c d ; do echo $var ; done

Make a valid selection (for instance 1) then make an invalid non-numeric selection (for instance @) and you will see that the value from your previous select is printed again. It should print a blank line.

2. The second one is more bizarre and problematic, and we may not have figured out the full details. It only seems to happen in a script. If you redirect a file descriptor on a prior command, name gets set to the selection in the list that corresponds to that file descriptor's number if the first item selected is invalid and non-numeric!

#!/bin/mksh
echo 2> /dev/null
select var in a b c d ; do echo $var ; done

Make that script and run it, then enter something non-numeric, such as @, and you will see it prints b rather than a blank line. Change 2> to 3> and it will print c, or change to 1> or simply > and it will print a.



Version-Release number of selected component (if applicable):
@(#)MIRBSD KSH R46 2013/05/02



How reproducible:
see above


Steps to Reproduce:
see above

Actual results:
see above

Expected results:
see above

Additional info:

Comment 2 Michal Hlavinka 2017-09-14 12:57:04 UTC
thanks for report, reproducible

Comment 8 errata-xmlrpc 2018-04-10 17:44:24 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, 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-2018:0951


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