On 2021-10-24 15:05, Edgar Pettijohn wrote:
> On 10/24/21 10:11 AM, Klemens Nanni wrote:
>> I fat fingered commands and it crashed. Here is a reproducer
>> (files do not have to exist):
>>
>> $ vi foo
>> :e
>> :e bar
>> :q!
>> vi(12918) in free(): write after free 0xea559a2d980
>> Abort
>> trap (core dumped)
>>
>> In words: open a file, open an empty file, open another file,
>> exit forcefully.
>
> If it helps to narrow this down I can't reproduce on 6.9
FWIW, I reproduced the segfault on 6.9 on amd64
$ uname -a
OpenBSD inspiron1420.attlocal.net 6.9 GENERIC.MP#4 amd64
$ rm -f foo 2>/dev/null # make sure it doesn't exist (see below)
$ vi foo
:e
:e bar
:q!
vi(61942) in free(): write after free 0x12513f7fe40
Abort trap (core
dumped)
and 7.0 on i386
$ uname -a
OpenBSD mini10o.attlocal.net 7.0 GENERIC.MP#210 i386
In each case, it required that the first file *not* exist. If I
issued a
$ touch foo
$ vi foo
:e
:e bar
:q!
it exited cleanly in both 6.9 & 7.0
I'm not sure how things are getting in a weird state, but when I
issue the ":e bar" from a "foo" that exists, I get no warning. But
when I issue the ":e bar" from a "foo" that doesn't exist, vi gives
me a warning I wouldn't have otherwise expected:
File is a temporary; exit will discard modifications.
which might have something to do with odd segfaulting state that
results later.
-tkc