Bug 1264077
Summary: | Tilda expansion failing in bash | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Martin Kyral <mkyral> | |
Component: | bash | Assignee: | Siteshwar Vashisht <svashisht> | |
Status: | CLOSED NOTABUG | QA Contact: | BaseOS QE - Apps <qe-baseos-apps> | |
Severity: | unspecified | Docs Contact: | ||
Priority: | unspecified | |||
Version: | 7.1 | CC: | isenfeld, jkejda, mkyral, svashisht | |
Target Milestone: | rc | |||
Target Release: | --- | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | Doc Type: | Bug Fix | ||
Doc Text: | Story Points: | --- | ||
Clone Of: | 802565 | |||
: | 1264802 (view as bug list) | Environment: | ||
Last Closed: | 2016-05-17 10:46:39 UTC | Type: | --- | |
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: | ||||
Bug Blocks: | 1264802, 1295396 |
Description
Martin Kyral
2015-09-17 12:55:53 UTC
Version-Release number of selected component (if applicable): bash-4.2.46-19.el7 On RHEL 7 I can see that both bash and ksh show same behaviour : I have this script under /root/root/bin/ : # cat /root/root/bin/date #!/bin/sh date and this is the reproducer code : # cat tmp.sh #!/usr/bin/bash echo $(~root/bin/date) ~root/bin/date If I execute the reproducer script, both commands expand to '/root/bin/date' : root@qeos-126 tmp]# ./tmp.sh ./tmp.sh: line 2: /root/bin/date: No such file or directory ./tmp.sh: line 3: /root/bin/date: No such file or directory If I modify the script to run ksh instead of bash : # cat tmp.sh #!/usr/bin/ksh echo $(~root/bin/date) ~root/bin/date I get same beahviour, both the commands expands to '/root/bin/date' : ./tmp.sh ./tmp.sh[2]: /root/bin/date: not found [No such file or directory] ./tmp.sh[3]: /root/bin/date: not found [No such file or directory] What should be the expected behaviour on RHEL 7 ? After some investigation I found out that there is no bug. The failing scenario is the following script: # cat tmp.sh #!/usr/bin/ksh echo $(~${USER}/bin/date) ~${USER}/bin/date man page says the following about expansion: The order of expansions is: brace expansion, tilde expansion, parameter, variable and arithmetic expansion and command substitution (done in a left-to-right fashion), word splitting, and pathname expansion. Because tilde expansion happens before variable expansion (apparently the opposite order is in ksh), the ~${USER} can't be resolved properly and it is expected. Thus, this is not a bug. Sorry for the fuss. |