This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1010760 - type command output function, Inconsistent with the function definition.
type command output function, Inconsistent with the function definition.
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: bash (Show other bugs)
6.5
All Linux
unspecified Severity unspecified
: rc
: ---
Assigned To: Ondrej Oprala
BaseOS QE - Apps
:
Depends On: 1010759 1010761
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-22 22:11 EDT by Yin.JianHong
Modified: 2016-01-31 21:09 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1010759
Environment:
Last Closed: 2014-02-21 09:15:38 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Yin.JianHong 2013-09-22 22:11:52 EDT
+++ This bug was initially created as a clone of Bug #1010759 +++

Description of problem:
type command output  function, Inconsistent with the function definition.

Version-Release number of selected component (if applicable):
[root@dhcp-13-194 ~]# rpm -q bash
bash-3.2-32.el5; in RHEL6.4 6.5 7.0 has the similar problem.

How reproducible:
100%

Steps to Reproduce:
1. f() { echo $1 | grep --color=auto  "kkk"; rm -i kkk; }
2. type f
3.

Actual results:
[root@dhcp-13-194 ~]# f() { echo $1 | grep --color=auto  "kkk"; rm -i kkk; }
[root@dhcp-13-194 ~]# type f
f is a function
f () 
{ 
    echo $1 | grep --color=auto "kkk";
    rm -i -i kkk  <<<--- here the '-i' was changed to double
}

Expected results:


Additional info:
Comment 1 Yin.JianHong 2013-09-22 22:13:00 EDT
test in RHEL6.5 latest RTT distro
[root@intel-canoepass-01 initscript]# f() { echo $1 | grep --color=auto "kkk"; rm -i kkk; }
[root@intel-canoepass-01 initscript]# type f
f is a function
f () 
{ 
    echo $1 | grep --color=auto "kkk";
    rm -i -i kkk   <<<--- here
}
[root@intel-canoepass-01 initscript]# rpm -q bash
bash-4.1.2-15.el6_4.x86_64
Comment 3 Ondrej Oprala 2014-02-21 09:15:38 EST
Petr Stodulka investigated this bug and found out this is actually caused by alias expansion.
I'm guessing you have an alias rm='rm -i' set, which bash then expands to 'rm -i -i'; which I do not consider a bug.

Please note it's a good coding habit to specify full paths for system utilities in shell scripts, which would also stop bash from silently expanding your alias.

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