Description of problem: In bash 4.4 the behavior changed with respect to builtin command 'command', called with /bin/sh. While in bash 4.3 the following works: # /bin/sh --version GNU bash, version 4.3.43(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. # /bin/sh -c 'command(){ echo FOO;}; command' FOO # It does not work any more in bash 4.4: # /bin/sh --version GNU bash, version 4.4.12(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. # /bin/sh -c 'command(){ echo FOO;}; command' /bin/sh: `command': is a special builtin # Version-Release number of selected component (if applicable): bash-4.4.12-6.fc26.x86_64 Additional info: I reported the same in bash-bug mailing list: http://lists.gnu.org/archive/html/bug-bash/2017-08/msg00012.html Answer: When in Posix mode, bash doesn't allow functions to be defined with the same name as a special builtin. It seems like RedHat added `command' to the list of special builtins in their custom build of bash-4.4. Open a ticket if they're your vendor. (http://lists.gnu.org/archive/html/bug-bash/2017-08/msg00014.html)
This is related to bug #1479222
Created attachment 1310503 [details] Fix value of BUILTIN_FLAG_REQUIRES I used incorrect value for BUILTIN_FLAG_REQUIRES while rebasing to bash-4.4. This patch fixes it.
You can make the script portable across various versions of bash using the following command: enable -n command Unfortunately, the above command is specific to bash. So you would need to run it conditionally to keep the script portable across other shells, too.
Comment on attachment 1310503 [details] Fix value of BUILTIN_FLAG_REQUIRES Thanks! It explains why I was not able to reproduce the bug with upstream bash.
bash-4.4.12-7.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-2b91680b10
bash-4.4.12-7.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-2b91680b10
bash-4.4.12-7.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.