Bug 1005900 - Built-in time command cannot be executed when the command is expanded from a variable
Built-in time command cannot be executed when the command is expanded from a ...
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: bash (Show other bugs)
20
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Roman Rakus
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-09 11:58 EDT by Petr Pisar
Modified: 2014-01-12 19:15 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-09-10 08:37:34 EDT
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 Petr Pisar 2013-09-09 11:58:42 EDT
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 12:03:51 EDT
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 08:37:34 EDT
(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 08:59:22 EDT
I see. So that's the difference between built-in command and keyword.

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