This bug is on both dash and busybox ash.

The "command" builtin is supposed to stop special builtins (such as
"eval") from exiting the shell on error. So doing something like

   isreadonly() {
      ! command eval "$1=" 2>/dev/null
   }

ought to be a way to test if a variable is read-only without the
performance hit of forking a subshell.

Using this function works fine in scripts, but it immediately makes an
interactive dash or ash exit. The same happens if you try a similar
command manually.

bash$ dash
$ readonly bla=123
$ command eval bla=457
dash: 1: eval: bla: is read only
$
bash$

After the "is read only" error, dash prints a prompt, but does not wait
for input and exits instead. Busybox ash does not even print the prompt
before exiting.

The funny part is that the interactive shell does not exit if you leave
out the 'command'. The very thing that is supposed to stop a
non-interactive shell from exiting makes an interactive shell exit.

HTH,

- M.
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to