Bug 1005900

Summary: Built-in time command cannot be executed when the command is expanded from a variable
Product: [Fedora] Fedora Reporter: Petr Pisar <ppisar>
Component: bashAssignee: Roman Rakus <rrakus>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: admiller, ooprala, rrakus, tsmetana
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-10 12:37:34 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:

Description Petr Pisar 2013-09-09 15:58:42 UTC
I have a very strange problem. I cannot execute `time' built-in command if the command is resolution of variable expansion:

root@fedora-21:~ # cat /tmp/expandedtime 
#!/bin/bash
set -x
VARIABLE="time"
"$VARIABLE" /bin/true
root@fedora-21:~ # /tmp/expandedtime 
+ VARIABLE=time
+ time /bin/true
/tmp/expandedtime: line 4: time: command not found
root@fedora-21:~ # time /bin/true

real    0m0.006s
user    0m0.002s
sys     0m0.004s
root@fedora-21:~ # type -a time
time is a shell keyword
root@fedora-21:~ # rpm -qf /bin/bash
bash-4.2.45-4.fc20.x86_64

I observe this problem in Fedora 21, and 20. I cannot reproduce it in Fedora 19. However my colleague has similar problem even in Fedora 19. Everything on x86_64. If I replace the `time' for some other built-in, like `help', the bug disappears.

Comment 1 Petr Pisar 2013-09-09 16:03:51 UTC
So I can reproduce it even in Fedora 19. If /usr/bin/time (from standalone `time' package) is installed, the script can execute time built-in. If I uninstall the package, it is not possible to execute the built-in.

Comment 2 Roman Rakus 2013-09-10 12:37:34 UTC
(In reply to Petr Pisar from comment #1)
> So I can reproduce it even in Fedora 19. If /usr/bin/time (from standalone
> `time' package) is installed, the script can execute time built-in. If I
> uninstall the package, it is not possible to execute the built-in.

time is not builtin. The same result is with `while' for example.

Comment 3 Petr Pisar 2013-09-10 12:59:22 UTC
I see. So that's the difference between built-in command and keyword.