bin/21089: vi silently corrupt open file on SIGINT when
entering :wq in command mode
Yar Tikhiy
yar at comp.chem.msu.su
Fri Feb 15 11:20:03 UTC 2008
The following reply was made to PR bin/21089; it has been noted by GNATS.
From: Yar Tikhiy <yar at comp.chem.msu.su>
To: Jaakko Heinonen <jh at saunalahti.fi>
Cc: bug-followup at freebsd.org
Subject: Re: bin/21089: vi silently corrupt open file on SIGINT when entering :wq in command mode
Date: Fri, 15 Feb 2008 14:14:39 +0300
On Tue, Feb 12, 2008 at 08:02:25PM +0200, Jaakko Heinonen wrote:
>
> On 2008-02-10, Yar Tikhiy wrote:
> > I think that you looked in the right direction but applied the fix
> > at a wrong level. In fact, we shouldn't put a test for INTERRUPTED(sp)
> > into each ex command's implementation.
>
> Agreed.
>
> [thanks for good analysis of the problem]
>
> > What perhaps is needed is a clear indication from v_txt() to its
> > caller that a special event ended text input, so that it can be up
> > to the caller to decide how to handle the event.
>
> What do you think about the attached patch? It sets a global state flag
> when a resize event occurs. I am not sure if it's a good way to do it.
Well, on the one hand, it's exactly the way interrupt events are
handled by nvi now. But, on the other hand, using a global state
flag has a remarkable downside: We'll have to remember to clear
it in each code path where it can be set. Otherwise problems similar
to this one will be likely to arise.
Upon a second thought, I'd rather follow the NetBSD way of dealing
with this issue. Their way was hackish not for nothing: it had to
deal with such complex cases of nvi text input as file name completion
and former input replay.
As a general remark, the NetBSD folks have invested a considerable
effort in fixing nvi bugs, and we may want to investigate if it would
be possible to borrow their patches and apply them to our tree.
--
Yar
More information about the freebsd-bugs
mailing list