zsh-users
 help / color / mirror / code / Atom feed
* Possible bug in zsh
@ 2003-12-29  8:02 Vincent Stemen
  2003-12-29  9:21 ` Wayne Davison
  0 siblings, 1 reply; 5+ messages in thread
From: Vincent Stemen @ 2003-12-29  8:02 UTC (permalink / raw)
  To: zsh-users

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
zsh-4.1.0.dev5.


<script>

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


_cmd=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
    fi

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

    return 0
fi

</script>

-- 
Vincent Stemen
Avoid the VeriSign/Network Solutions domain registration trap!
http://www.InetAddresses.net


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-01-03 23:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-29  8:02 Possible bug in zsh Vincent Stemen
2003-12-29  9:21 ` Wayne Davison
2004-01-01 23:38   ` Wayne Davison
2004-01-02  1:32     ` James Devenish
2004-01-03 23:09     ` Vincent Stemen

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).