Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Possible bug in zsh

I think I may have encountered a bug in Z shell.  It began when I
tried linking /bin/sh to zsh on FreeBSD-5.1.  When it reboots, I get a
lot of errors from the init scripts because the rootfs does not get
re-mounted read-writable.  I have isolated the piece of init script
code and included a small script below, extracted from the init
scripts and modified for testing, that reproduces the problem.  See
the comments in the script.

The problem goes away if I remove the [ -n "$_precmd" ] statement
which, so far as I can tell, should have no effect on the following if
statement where the problem is.  I tested with zsh-4.0.9 and


    # This function normally remounts / in rw mode
    echo "<< Running root_start() >>"


if [ -n "$_cmd" ]; then
            # if the precmd failed and force
            # isn't set, exit

    # Remove or comment out these two lines and the problem goes away.
    # ie. zsh does not return 1 in the next statement.
    [ -n "$_precmd" ] &&
        echo "run_rc_command: evaluating ${_precmd}()."

    # $_precmd is null.
    # zsh enters this if statement and returns 1, causing root_start() to
    # never get run, thus leaving /
    # mounted ro.  FreeBSD's sh and bash do not.

    if ! eval $_precmd && [ -z "$rc_force" ]; then
        return 1

    [ -n "$_cmd" ] &&
        echo "run_rc_command: evaluating ${_cmd}()."
    if ! eval $_cmd && [ -z "$rc_force" ]; then
        return 1

    return 0


Vincent Stemen
Avoid the VeriSign/Network Solutions domain registration trap!

Messages sorted by: Reverse Date, Date, Thread, Author