Shell has a concept of "special builtin utilities": builtins which are special have a few properties which are different from the builtins which are merely optimizations (for example, "echo" builtin is not special, it is an optimization: we don't want to fork an entire process in order to print a few bytes). In particular: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html "2.14. Special Built-In Utilities ... A syntax error in a special built-in utility may cause a shell executing that utility to abort, while a syntax error in a regular built-in utility shall not cause a shell executing that utility to abort." However. There is a (regular, non-special) builtin, "command": http://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html which is required to "nullify" this effect: "If the command_name is the same as the name of one of the special built-in utilities, the special properties in the enumerated list at the beginning of 'Special Built-In Utilities' shall not occur." The bug is that in Posix mode (for example, if called as "sh", not "bash"), bash aborts in this example: sh -c 'readonly VAR=123; command eval "VAR=123"; echo $?' The bug is that "echo $?" command is not executed: shell aborted execution before reaching it. There exist scripts which use this construct to detect whether a given variable is read-only.
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle. Changing version to '26'.
https://lists.gnu.org/archive/html/bug-bash/2017-04/msg00144.html
diff --git a/subst.c b/subst.c index 65e7d08..998b850 100644 --- a/subst.c +++ b/subst.c @@ -10863,11 +10863,12 @@ expand_word_list_internal (list, eflags) tint = do_word_assignment (temp_list->word, 0); this_command_name = savecmd; /* Variable assignment errors in non-interactive shells - running in Posix.2 mode cause the shell to exit. */ + running in Posix.2 mode cause the shell to exit, unless + they are being run by the `command' builtin. */ if (tint == 0) { last_command_exit_value = EXECUTION_FAILURE; - if (interactive_shell == 0 && posixly_correct) + if (interactive_shell == 0 && posixly_correct && executing_command_builtin == 0) exp_jump_to_top_level (FORCE_EOF); else exp_jump_to_top_level (DISCARD);
bash-4.4.12-5.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-84add424bf
bash-4.4.12-5.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-84add424bf
bash-4.4.12-5.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.