I've discovered the following tilde expansion inconsistency. Here
the behaviour of the tilde expansion depends on the name of the function.
--- a ---
alias() {
echo "$1"
}
alias f=~
alias2() {
echo "$1"
}
alias2 f=~
------
$ bash -o posix a
f=/home/gondolin/herbert
f=~
Matthias Klose wrote: You're certainly not the first to discover it. Bash does `assignment-statement-like' tilde expansion for builtins that take assignment statements as arguments. It does it by name, and can be tripped up by shell functions that override builtins. Bash and ksh93 do this for builtins like declare/typeset, alias, etc. in anticipation of the day that POSIX.2 specifies things to behave that way. One could argue that if you want to use functions to replace or augment builtins, you should be prepared for the consequences. Chet
Matthias Klose wrote: You're certainly not the first to discover it. Bash does `assignment-statement-like' tilde expansion for builtins that take assignment statements as arguments. It does it by name, and can be tripped up by shell functions that override builtins. Bash and ksh93 do this for builtins like declare/typeset, alias, etc. in anticipation of the day that POSIX.2 specifies things to behave that way. One could argue that if you want to use functions to replace or augment builtins, you should be prepared for the consequences. Chet
I understand. I made dash do that too for a while until inconsistencies like this showed up. That is understandable for builtins, but is it likely that POSIX will ever specify this for aliases/functions that bear the same name?
fixed 186994 bash/3.0-16 stop I close that bug. According to the logs, I think this bug is fixed since at least the 3.0.16 release. In any case, a simple test shows that this bug is fixed. Regards, PS: See CHANGE file in ftp://ftp.gnu.org/gnu/bash/bash-3.0.16.tar.gz
reopen 186994 quit I just tested it with bash 4.2+dfsg-0.1 and it still does exactly the same thing. Did you actually test with -o posix? Thanks,