Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../. -I.././include -I.././lib -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall uname output: Linux x 4.13.0-26-generic #29~16.04.2-Ubuntu SMP Tue Jan 9 22:00:44 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.3 Patch Level: 48 Release Status: release Description: Bash unexpectedly evaluates a builtin command argument when it is executed after `time` keyword. This does not happen when the builtin command is executed at later time or with different type of argument. Repeat-By: Following bash script will trigger the issue. --------------------[script start]-------------------- #!/bin/bash if [ "$0" = "$BASH_SOURCE" ]; then echo "source $0 <cmd>" exit fi if [ ! "$#" = 1 ]; then echo "[*] missing argument" return fi alias exp='"$($1)"' echo "[*] type exp: $(type exp)" echo "[*] executing command: $1" set -o xtrace echo exp time echo exp echo exp --------------------[script end ]-------------------- Example output when the issue occurs: --------------------[output start]-------------------- $ source ./bashexp.sh "date" [*] type exp: exp is aliased to `"$($1)"' [*] executing command: date ++ echo exp exp real 0m0.000s user 0m0.000s sys 0m0.000s +++ date ++ echo 'T jaan 16 10:29:24 EET 2018' T jaan 16 10:29:24 EET 2018 ++ echo exp exp --------------------[output end ]--------------------
signature.asc
Description: OpenPGP digital signature