Bug 1237213 - Importing Exported Functions with Hyphens
Summary: Importing Exported Functions with Hyphens
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: bash
Version: 7.1
Hardware: x86_64
OS: Linux
Target Milestone: rc
: ---
Assignee: Ondrej Oprala
QA Contact: Martin Kyral
Depends On: 1148507
TreeView+ depends on / blocked
Reported: 2015-06-30 14:36 UTC by Martin Kyral
Modified: 2015-11-19 04:39 UTC (History)
7 users (show)

Fixed In Version: bash-4.2.46-18.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 1148507
Last Closed: 2015-11-19 04:39:53 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2144 normal SHIPPED_LIVE bash bug fix update 2015-11-19 08:06:34 UTC

Description Martin Kyral 2015-06-30 14:36:40 UTC
+++ This bug was initially created as a clone of Bug #1148507 +++

Description of problem:

Importing of functions that were previously exported with `export -f' fails if the function name contains a hyphen (i.e. '-').

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


How reproducible:


[cperl@localhost /tmp]$ rpm -qa bash
[cperl@localhost /tmp]$ foo-bar () { echo a; }
[cperl@localhost /tmp]$ foo-bar
[cperl@localhost /tmp]$ export -f foo-bar
[cperl@localhost /tmp]$ bash
bash: error importing function definition for `BASH_FUNC_foo-bar'
[cperl@localhost /tmp]$ 

Actual results:

Importing of previously exported functions whose name have a hyphen in them fails.

Expected results:

Importing of previously exported functions whose name have a hyphen in them should work.

Additional info:

This has been discussed in a few places already [1][2].  However, it looks like the latest upstream patch at [3] (bash 4.3, patch 27, git commit 3590145af6f1c9fa321dff231f69ae696e7e740b) actually fixes this.

I believe the relevant part of the patch is:

-         if (legal_identifier (name))
-           parse_and_execute (temp_string, name, SEVAL_NONINT|SEVAL_NOHIST|SEVAL_FUNCDEF|SEVAL_ONECMD);
+         if (absolute_program (tname) == 0 && (posixly_correct == 0 || legal_identifier (tname)))
+           parse_and_execute (temp_string, tname, SEVAL_NONINT|SEVAL_NOHIST|SEVAL_FUNCDEF|SEVAL_ONECMD);

Would it be possible to release a new bash 4.1 package for RHEL 6.5 with the patch updated to accommodate this change?

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1148318 (this is for fedora, which is why I'm opening this bug)
[2] https://lists.gnu.org/archive/html/bug-bash/2014-09/msg00186.html
[3] git://git.savannah.gnu.org/bash.git


The same bug is present in RHEL 7.1. It shall be fixed here as upgrading from RHEL 6 (fixed) to RHEL 7 (unfixed) would cause regression.

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


Comment 5 errata-xmlrpc 2015-11-19 04:39:53 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.


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