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

Re: Bug#303623: [andrew@xxxxxxxxxxx: Bug#303623: zsh: CHECK_JOBS doesn't work when only one command was run since last Control-D]



On Apr 9,  4:47pm, Andrew Pimlott wrote:
} Subject: Re: Bug#303623: [andrew@xxxxxxxxxxx: Bug#303623: zsh: CHECK_JOBS 
}
} > The issue here seems to be that zsh doesn't actually receive a ctrl-D
} > keystroke, but rather that there is a true end-of-file on the tty.
} 
} Ok, but I don't think this should preclude correct behavior.  My
} understanding is that when <C-D> is pressed, the application gets a
} zero-length read on the terminal

If the TTY driver is interpreting the EOF character, then yes, that is
what happens.  However, zsh supposedly doesn't allow the TTY driver to
interpret <C-d>; it puts the terminal in CBREAK mode, so it receives a
literal ASCII '\04' character, so that it's able to invoke the bindkey
for that, which normally runs delete-char-or-list.

The do-not-exit-when-jobs-are-pending behavior relies on having read a
'\04' when the input buffer is empty.  It's a simulated end-of-file
rather than a real one.

What *appears* to be happening -- I could still be wrong -- is that on
the second C-d the CBREAK setting fails to work as expected and zsh in
fact gets a zero-length read.  When ignoreeof is not set, this causes
the shell to exit.

The point being that although I agree this is not the correct behavior,
the reason for the failure is not what you may think, and therefore the
fix is likely to be in a more obscure part of the C code.  Further, the
workaround in the meantime is to setopt ignoreeof.



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