Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Nilesh Patra
On Fri, Jul 14, 2023 at 09:02:31PM +0200, Robin Jarry wrote:
> Nilesh Patra, Jul 14, 2023 at 20:35:
> > On Fri, Jul 14, 2023 at 08:13:16PM +0200, Robin Jarry wrote:
> > > Nilesh Patra, Jul 14, 2023 at 19:59:
> > > > There you go
> > > >
> > > > https://pb.envs.net/?816fb8c61575e2ba#4kD2xS4wJMGrsCd8tBhPfqHDJZ7qeM6qERaobgoYj46F
> > > 
> > > Thanks a lot that helps. It looks like there is a deadlock due to two
> > > goroutines trying to interact with the terminal:
> >
> > I'm going ahead with an upload in debian with this patch backported.
> > From a distro pov I consider this a major breakeage. Given that aerc is
> > designed to facilitate patch workflow as a goal, it makes it useless if
> > I can't paste more than 4-5 lines in one go.
> >
> > If you disagree, feel free to revert the upload. You have the rights.
> 
> Sure thing. It is certainly less risky than tagging a release in a rush.

Thanks a lot for quick response and the patch!

Best,
Nilesh


signature.asc
Description: PGP signature


Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Tim Culverhouse
On Fri Jul 14, 2023 at 1:35 PM CDT, Nilesh Patra wrote:
> On Fri, Jul 14, 2023 at 08:13:16PM +0200, Robin Jarry wrote:
> > Nilesh Patra, Jul 14, 2023 at 19:59:
> > > There you go
> > >
> > > https://pb.envs.net/?816fb8c61575e2ba#4kD2xS4wJMGrsCd8tBhPfqHDJZ7qeM6qERaobgoYj46F
> > 
> > Thanks a lot that helps. It looks like there is a deadlock due to two
> > goroutines trying to interact with the terminal:
>
> I'm going ahead with an upload in debian with this patch backported.
> From a distro pov I consider this a major breakeage. Given that aerc is
> designed to facilitate patch workflow as a goal, it makes it useless if
> I can't paste more than 4-5 lines in one go.

I agree, this was a particularly bad breakage on this release. I think
backporting this patch is a must. Thanks for backporting!

-- 
Tim



Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Robin Jarry
Nilesh Patra, Jul 14, 2023 at 20:35:
> On Fri, Jul 14, 2023 at 08:13:16PM +0200, Robin Jarry wrote:
> > Nilesh Patra, Jul 14, 2023 at 19:59:
> > > There you go
> > >
> > > https://pb.envs.net/?816fb8c61575e2ba#4kD2xS4wJMGrsCd8tBhPfqHDJZ7qeM6qERaobgoYj46F
> > 
> > Thanks a lot that helps. It looks like there is a deadlock due to two
> > goroutines trying to interact with the terminal:
>
> I'm going ahead with an upload in debian with this patch backported.
> From a distro pov I consider this a major breakeage. Given that aerc is
> designed to facilitate patch workflow as a goal, it makes it useless if
> I can't paste more than 4-5 lines in one go.
>
> If you disagree, feel free to revert the upload. You have the rights.

Sure thing. It is certainly less risky than tagging a release in a rush.



Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Nilesh Patra
On Fri, Jul 14, 2023 at 08:13:16PM +0200, Robin Jarry wrote:
> Nilesh Patra, Jul 14, 2023 at 19:59:
> > There you go
> >
> > https://pb.envs.net/?816fb8c61575e2ba#4kD2xS4wJMGrsCd8tBhPfqHDJZ7qeM6qERaobgoYj46F
> 
> Thanks a lot that helps. It looks like there is a deadlock due to two
> goroutines trying to interact with the terminal:

I'm going ahead with an upload in debian with this patch backported.
From a distro pov I consider this a major breakeage. Given that aerc is
designed to facilitate patch workflow as a goal, it makes it useless if
I can't paste more than 4-5 lines in one go.

If you disagree, feel free to revert the upload. You have the rights.

Best,
Nilesh


signature.asc
Description: PGP signature


Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Nilesh Patra
On Fri, Jul 14, 2023 at 11:22:09PM +0530, Nilesh Patra wrote:
> I fiddled a bit and noticed that it works OK on aerc 0.14.0 and I notice
> the odd behavior on aerc 0.15.0.
> 
> Something changed between these two which causes it to explode.

I did a bisect meanwhile and found the commit that broke it.
Didn't review the diff but probably some race condition sneeked in
somewhere.

c7b122f4c4a87cd54402c78465e1a5c882f37aeb is the first bad commit
commit c7b122f4c4a87cd54402c78465e1a5c882f37aeb
Author: Tim Culverhouse 
Date:   Sun Apr 23 08:01:23 2023 -0500

tcell-term: upgrade to latest release

Upgrade tcell-term to latest release.

This is a complete rewrite of tcell-term, and includes many minor bug
fixes and overall improvements. Notably:

- Improved parsing
- One fewer goroutine
- Improved API
- Improved redraw messaging
- Improved key support
- Improved mouse support

Signed-off-by: Tim Culverhouse 
Acked-by: Robin Jarry

 go.mod  |  6 +++---
 go.sum  | 10 +++---
 widgets/terminal.go | 35 +++
 3 files changed, 29 insertions(+), 22 deletions(-)

Best,
Nilesh


signature.asc
Description: PGP signature


Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Robin Jarry
Nilesh Patra, Jul 14, 2023 at 19:59:
> There you go
>
> https://pb.envs.net/?816fb8c61575e2ba#4kD2xS4wJMGrsCd8tBhPfqHDJZ7qeM6qERaobgoYj46F

Thanks a lot that helps. It looks like there is a deadlock due to two
goroutines trying to interact with the terminal:

goroutine 1 [sync.Mutex.Lock]:

sync.(*Mutex).Lock(...)
sync/mutex.go:90
git.sr.ht/~rockorager/tcell-term.(*VT).HandleEvent(0xc000158c80, {0xc5ce80?, 
0xc0007fff60?})
git.sr.ht/~rockorager/tcell-term@v0.7.1/vt.go:452 +0x6d fp=0xc000a2db40 
sp=0xc000a2dad8 pc=0x9a72cd
git.sr.ht/~rjarry/aerc/widgets.(*Terminal).Event(0xc000b26280?, {0xc5ce80?, 
0xc0007fff60?})
git.sr.ht/~rjarry/aerc/widgets/terminal.go:189 +0x72 fp=0xc000a2db68 
sp=0xc000a2db40 pc=0x9e72d2
git.sr.ht/~rjarry/aerc/widgets.(*Composer).Event(0xc000a2dc48?, {0xc5ce80?, 
0xc0007fff60?})
git.sr.ht/~rjarry/aerc/widgets/compose.go:669 +0xcf fp=0xc000a2dbb8 
sp=0xc000a2db68 pc=0x9c43af
git.sr.ht/~rjarry/aerc/widgets.(*Aerc).Event(0xc062e8?, {0xc5ce80?, 
0xc0007fff60?})
git.sr.ht/~rjarry/aerc/widgets/aerc.go:316 +0xc3 fp=0xc000a2dc30 
sp=0xc000a2dbb8 pc=0x9ba1a3
git.sr.ht/~rjarry/aerc/lib/ui.(*UI).HandleEvent(0xc4a040, {0xc5ce80?, 
0xc0007fff60})
git.sr.ht/~rjarry/aerc/lib/ui/ui.go:150 +0x162 fp=0xc000a2dc80 
sp=0xc000a2dc30 pc=0x6a79c2
main.main()
git.sr.ht/~rjarry/aerc/main.go:266 +0xb45 fp=0xc000a2df80 
sp=0xc000a2dc80 pc=0xa32fe5

goroutine 102 [chan send]:

git.sr.ht/~rjarry/aerc/lib/ui.QueueRedraw(...)
git.sr.ht/~rjarry/aerc/lib/ui/ui.go:30
git.sr.ht/~rjarry/aerc/widgets.(*Terminal).HandleEvent(0x8?, {0xc5c140?, 
0xc00094e850?})
git.sr.ht/~rjarry/aerc/widgets/terminal.go:168 +0x9c fp=0xc000435e38 
sp=0xc000435e10 pc=0x9e71bc
git.sr.ht/~rjarry/aerc/widgets.(*Terminal).HandleEvent-fm({0xc5c140?, 
0xc00094e850?})
:1 +0x39 fp=0xc000435e60 sp=0xc000435e38 pc=0x9e9fb9
git.sr.ht/~rockorager/tcell-term.(*VT).postEvent(...)
git.sr.ht/~rockorager/tcell-term@v0.7.1/vt.go:414
git.sr.ht/~rockorager/tcell-term.(*VT).update(0xc000158c80, {0xb119c0?, 
0xc000b24940?})
git.sr.ht/~rockorager/tcell-term@v0.7.1/vt.go:195 +0x489 
fp=0xc000435f80 sp=0xc000435e60 pc=0x9a50e9
git.sr.ht/~rockorager/tcell-term.(*VT).Start.func1()
git.sr.ht/~rockorager/tcell-term@v0.7.1/vt.go:165 +0x2d fp=0xc000435fe0 
sp=0xc000435f80 pc=0x9a4b2d
runtime.goexit()
runtime/asm_amd64.s:1598 +0x1 fp=0xc000435fe8 sp=0xc000435fe0 
pc=0x469781
created by git.sr.ht/~rockorager/tcell-term.(*VT).Start
git.sr.ht/~rockorager/tcell-term@v0.7.1/vt.go:155 +0x33c

It looks like a known issue that has been fixed by this commit:

https://git.sr.ht/~rjarry/aerc/commit/916bca33ea6cf2530117071fdd9b7b15e00e2f29

Not released yet.



Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Koni Marti
On Fri Jul 14, 2023 at 7:59 PM CEST, Nilesh Patra wrote:
> On Fri, Jul 14, 2023 at 07:47:33PM +0200, Robin Jarry wrote:
> > After aerc has died, share the trace.log file contents. Ideally via
> > paste service, lists.sr.ht bounce emails that have attachments.
>
> There you go
>
> https://pb.envs.net/?816fb8c61575e2ba#4kD2xS4wJMGrsCd8tBhPfqHDJZ7qeM6qERaobgoYj46F

I can reproduce the issue on the released version (0.15.2). However, it
seems fixed on current master. I think commit 9a20640f ("ui: avoid races
with queue redraw") fixed this issue as well.

If I read your log correctly, you are running 0.15.0. Could you maybe
try the latest master?



Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Nilesh Patra
On Fri, Jul 14, 2023 at 07:47:33PM +0200, Robin Jarry wrote:
> After aerc has died, share the trace.log file contents. Ideally via
> paste service, lists.sr.ht bounce emails that have attachments.

There you go

https://pb.envs.net/?816fb8c61575e2ba#4kD2xS4wJMGrsCd8tBhPfqHDJZ7qeM6qERaobgoYj46F

Best,
Nilesh


signature.asc
Description: PGP signature


Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Nilesh Patra
I fiddled a bit and noticed that it works OK on aerc 0.14.0 and I notice
the odd behavior on aerc 0.15.0.

Something changed between these two which causes it to explode.

Best,
Nilesh


signature.asc
Description: PGP signature


Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Robin Jarry
If you manage to reproduce this easily, could you try the following:

1) aerc >trace.log 2>&1
2) Compose a message reproduce the freeze.
3) From another terminal, kill aerc with SIGQUIT.

After aerc has died, share the trace.log file contents. Ideally via
paste service, lists.sr.ht bounce emails that have attachments.

Thanks



Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Robin Jarry
Nilesh Patra, Jul 14, 2023 at 19:14:
> Are you using debian though?

No, I am on Fedora 38.

Linux ringo 6.3.11-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Jul  2 13:17:31 
UTC 2023 x86_64 GNU/Linux
go version go1.20.5 linux/amd64
sway version 1.8.1
foot version: 1.14.0 -pgo +ime +graphemes -assertions
aerc 0.15.2-96-gae07f640371e +notmuch (go1.20.5 amd64 linux)
NVIM v0.9.1
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc -O2 -g -Og -g -Wall -Wextra -pedantic 
-Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion 
-Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute 
-Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough 
-fdiagnostics-color=auto -fstack-protector-strong -DUNIT_TESTING 
-DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/usr/include/luajit-2.1 
-I/usr/include -I/usr/include/luv 
-I/builddir/build/BUILD/neovim-0.9.1/redhat-linux-build/src/nvim/auto 
-I/builddir/build/BUILD/neovim-0.9.1/redhat-linux-build/include 
-I/builddir/build/BUILD/neovim-0.9.1/redhat-linux-build/cmake.config 
-I/builddir/build/BUILD/neovim-0.9.1/src -I/usr/include -I/usr/include 
-I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include



Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Nilesh Patra
On Fri, Jul 14, 2023 at 12:25:37PM -0500, Tim Culverhouse wrote:
> On Fri Jul 14, 2023 at 12:14 PM CDT, Nilesh Patra wrote:
> > And... I tried with wezterm. It worked on first try, but on trying to
> > paste the text 2-3 times in a row (on the same compose area) I'm able to
> > see a hang.
> 
> Are you in insert mode when pasting?

Ofcourse!

> > Are you using debian though?
> 
> No, I'm on Arch 
> (btw).
  ^^^

Lol.

Best,
Nilesh


signature.asc
Description: PGP signature


Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Tim Culverhouse
On Fri Jul 14, 2023 at 12:14 PM CDT, Nilesh Patra wrote:
> On Fri, Jul 14, 2023 at 11:19:32AM -0500, Tim Culverhouse wrote:
> > I also can't repro. I tried pasting "hello world\n"x100, and "hello 
> > world"x100
> > (all on the same line), both in vim and nvim, and in foot and wezterm - all 
> > of
> > those combinations work.
>
> I tried with qterminal, kitty and deepin-terminal and I could repro it in
> all the three. I really doubt if it is specific to terminal.
>
> And... I tried with wezterm. It worked on first try, but on trying to
> paste the text 2-3 times in a row (on the same compose area) I'm able to
> see a hang.

Are you in insert mode when pasting?

> Are you using debian though?

No, I'm on Arch (btw).

-- 
Tim



Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Tim Culverhouse
On Fri Jul 14, 2023 at 11:36 AM CDT, Robin Jarry wrote:
> pelle, Jul 14, 2023 at 18:23:
> > > Robin and I are both on wayland...I'm guessing with xclip you are on
> > > X? I wonder if that comes into play at all?
> >
> > I'm having the issue in Sway. I've noticed that the freeze happens in
> > vim when pasting with `CTRL+V` or `SHIFT+INSERT` while pasting works
> > fine with `p`.
>
> I assume that you enter insert mode before pasting with `CTRL+V` or
> `SHIFT+INSERT`. Tim, could it be a race with tcell term?

Could be...sounds like a race somewhere. I've tested tcell-term up and down with
--race and can't find any races.

-- 
Tim



Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Nilesh Patra
On Fri, Jul 14, 2023 at 11:19:32AM -0500, Tim Culverhouse wrote:
> I also can't repro. I tried pasting "hello world\n"x100, and "hello world"x100
> (all on the same line), both in vim and nvim, and in foot and wezterm - all of
> those combinations work.

I tried with qterminal, kitty and deepin-terminal and I could repro it in
all the three. I really doubt if it is specific to terminal.

And... I tried with wezterm. It worked on first try, but on trying to
paste the text 2-3 times in a row (on the same compose area) I'm able to
see a hang.

Are you using debian though?

> Robin and I are both on wayland...I'm guessing with xclip you are on X? I 
> wonder
> if that comes into play at all?

It does not. I tried with a KDE with wayland now, and can repro.

Best,
Nilesh


signature.asc
Description: PGP signature


Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Robin Jarry
pelle, Jul 14, 2023 at 18:23:
> > Robin and I are both on wayland...I'm guessing with xclip you are on
> > X? I wonder if that comes into play at all?
>
> I'm having the issue in Sway. I've noticed that the freeze happens in
> vim when pasting with `CTRL+V` or `SHIFT+INSERT` while pasting works
> fine with `p`.

I assume that you enter insert mode before pasting with `CTRL+V` or
`SHIFT+INSERT`. Tim, could it be a race with tcell term?



Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread pelle
> Robin and I are both on wayland...I'm guessing with xclip you are on X? I 
> wonder
> if that comes into play at all?

I'm having the issue in Sway. I've noticed that the freeze happens in vim when 
pasting with `CTRL+V` or `SHIFT+INSERT` while pasting works fine with `p`.



Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Tim Culverhouse
On Fri Jul 14, 2023 at 11:06 AM CDT, Nilesh Patra wrote:
> On Fri, Jul 14, 2023 at 05:49:41PM +0200, Robin Jarry wrote:
> > I cannot reproduce this but maybe Tim can have a look.
>
> This is an upstream bug, and I can repro it by building aerc via make,
> i.e. there are no debian go packages at play here.
>
> Interestingly, this bug does not get triggered when I use micro as my
> editor (a golang based text editor).
>
> Here's the way I could reproduce:
>
> $ for in in {0..100}; do echo 'hello world' >> /tmp/hwl; done
> $ cat /tmp/hwl | xclip -sel clipboard
> $ EDITOR=vim ./aerc
>
> :compose
>
> Goto the body and try paste using ctrl+shift+v or shift+Ins (whatever
> bindings are default for your terminal). You'll see it hanging --
> sometimes with half-pasted text.
>
> I get the same result when I try with EDITOR=nano.
>
> Best,
> Nilesh

I also can't repro. I tried pasting "hello world\n"x100, and "hello world"x100
(all on the same line), both in vim and nvim, and in foot and wezterm - all of
those combinations work.

Robin and I are both on wayland...I'm guessing with xclip you are on X? I wonder
if that comes into play at all?

-- 
Tim



Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Nilesh Patra
On Fri, Jul 14, 2023 at 05:49:41PM +0200, Robin Jarry wrote:
> I cannot reproduce this but maybe Tim can have a look.

This is an upstream bug, and I can repro it by building aerc via make,
i.e. there are no debian go packages at play here.

Interestingly, this bug does not get triggered when I use micro as my
editor (a golang based text editor).

Here's the way I could reproduce:

$ for in in {0..100}; do echo 'hello world' >> /tmp/hwl; done
$ cat /tmp/hwl | xclip -sel clipboard
$ EDITOR=vim ./aerc

:compose

Goto the body and try paste using ctrl+shift+v or shift+Ins (whatever
bindings are default for your terminal). You'll see it hanging --
sometimes with half-pasted text.

I get the same result when I try with EDITOR=nano.

Best,
Nilesh


signature.asc
Description: PGP signature


Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-14 Thread Robin Jarry
Nilesh Patra, Jul 13, 2023 at 19:27:
> Hi,
>
> On Wed, 12 Jul 2023 11:09:03 +0200 Pelle  wrote:
> > Package: aerc
> > Version: 0.15.2-1
> > Severity: normal
> > 
> > I find that aerc almost always freezes when pasting into the compose area.
> > 
> > It can easily be reproduced here:
> >* Open aerc.
> >* Compose an email.
> >* Move cursor from headers onto the email body compose area.
> >* In another window, open a text editor, enter "hello world" 100 times 
> > and copy it.
> >* Back in aerc, paste into the compose area by `SHIFT+INSERT`
> >* Some of the text will be pasted, but then aerc will get stuck, 
> > sometimes like "hell|"
> >* Aerc stops responding to any input, including `CTRL+C`
> > 
> > I have tested an confirmed this is an issue whether using vim or nvim text 
> > editor, and whether using kitty, alacritty or foot terminal emulator.
>
> Thanks for reporting this, and I can confirm the behavior. @Robin, is
> this an issue known to you as upstream?
> Could you please take a look at this?

Hi Nilesh,

I cannot reproduce this but maybe Tim can have a look.

What editor is this?



Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-13 Thread Nilesh Patra
Hi,

On Wed, 12 Jul 2023 11:09:03 +0200 Pelle  wrote:
> Package: aerc
> Version: 0.15.2-1
> Severity: normal
> 
> I find that aerc almost always freezes when pasting into the compose area.
> 
> It can easily be reproduced here:
>* Open aerc.
>* Compose an email.
>* Move cursor from headers onto the email body compose area.
>* In another window, open a text editor, enter "hello world" 100 times and 
> copy it.
>* Back in aerc, paste into the compose area by `SHIFT+INSERT`
>* Some of the text will be pasted, but then aerc will get stuck, sometimes 
> like "hell|"
>* Aerc stops responding to any input, including `CTRL+C`
> 
> I have tested an confirmed this is an issue whether using vim or nvim text 
> editor, and whether using kitty, alacritty or foot terminal emulator.

Thanks for reporting this, and I can confirm the behavior. @Robin, is
this an issue known to you as upstream?
Could you please take a look at this?

Best,
Nilesh


signature.asc
Description: PGP signature


Bug#1040907: aerc: Freeze when pasting to body on email compose

2023-07-12 Thread Pelle
Package: aerc
Version: 0.15.2-1
Severity: normal

Dear aerc maintainer,

I find that aerc almost always freezes when pasting into the compose area.

It can easily be reproduced here:
   * Open aerc.
   * Compose an email.
   * Move cursor from headers onto the email body compose area.
   * In another window, open a text editor, enter "hello world" 100 times and 
copy it.
   * Back in aerc, paste into the compose area by `SHIFT+INSERT`
   * Some of the text will be pasted, but then aerc will get stuck, sometimes 
like "hell|"
   * Aerc stops responding to any input, including `CTRL+C`

I have tested an confirmed this is an issue whether using vim or nvim text 
editor, and whether using kitty, alacritty or foot terminal emulator.

-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 6.3.0-2-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_FIRMWARE_WORKAROUND
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages aerc depends on:
ii  libc62.37-5
ii  libnotmuch5  0.37-1+b1

Versions of packages aerc recommends:
ii  dante-client  1.4.2+dfsg-7
ii  gnupg 2.2.40-1.1
pn  w3m   

Versions of packages aerc suggests:
ii  notmuch  0.37-1+b1

-- no debconf information