Closed aksr closed 6 years ago
Can you paste a file that does trigger this?
Because of the encoding and/or line terminators, it isn't possible to paste this kind of file.
Let me see to upload it somewhere, so you can confirm this, if it's okay?
Can you pipe the file through hexdump -x and paste this? I just want to make sure I am trying the right thing.
What I am seeing there: when I hit q immediately, sometimes the file still wants to get placed, i.e. the curser changes to the resize cursor.
In this mode sam does not accept any comand until the file has been reshaped or the reshaping is aborted.
Is that the case on your side too?
Yes.
Hm, normal files don't demand to be placed (before quitting)—that seems strange, I haven't noticed cursor (while it was hidden.).
Indeed, I suspect some race for input due to the issued warning... @deadpixi What do you think?
@ckeen @aksr
Sorta-kinda there's a race condition, yeah.
sam
removes nulls from file content for various reasons. When it does so, it more-or-less marks the file as modified, which sets the global quitok
variable to false and hilarity ensues.
I've gone ahead and made it such that the presences of nulls is not itself sufficient to block quitting; you'll still get a warning.
This doesn't fix the similar issue of read error on load (e.g. if the file doesn't exist). That's more difficult to fix cleanly. I'll keep working on it, but I'll close this issue for now. Please, @aksr, reopen it if the code in master doesn't address this issue.
@aksr @ckeen I also just overhauled (well, started to), the IO subsystem. The code is in master, if you'd be so kind as to try it out. :)
It seems the bug is fixed.
I have a file like this:
Hitting
q
immediately whensam
is started, causessam
to freeze.I'm not sure but, I think
sam
generates warning message as soon as it's started (even though warning message isn't shown), I don't think it's related to encoding and/or line terminators. Encoding and etc. are only important while they cause sam to generate warning.In short, if the file generates warning message as soon as it's started with
sam
(e.g.sam testfile
), but not open, hittingq
key will cause freeze.