la5nta / pat

A cross-platform Winlink client written in Go
https://getpat.io
MIT License
488 stars 86 forks source link

pat compose with no 'to' or 'cc' address causes multiple issues #89

Closed ai6yr closed 7 years ago

ai6yr commented 7 years ago

If you (accidentally) send a message with no "to" or "cc" address, the following issue are encountered:

  1. pat read will not display the outbox (error: panic: runtime error: index out of range)
  2. pat connect will fail to receive, while message is still in outbox. (error: **Unable to save received message - no 'to' or 'cc' address - Disconnecting). The failure to send a message to a WINLINK server means that no messages will be received until that message is successfuly sent; the send/receive probably should be more independent.
  3. pat http does not provide ability to remove problematic message.

Workaround is to manually go to ~/.wl2k/outbox and rm the erroneous message. However, pat probably should handle this error case in a more user friendly manner. In particular, the inability to access the outbox programatically may be an issue.

martinhpedersen commented 7 years ago

Excellent - Thank you for the bug report.

I don't believe it will be hard to reproduce this problem, but a copy of the full log output of each reported issue would be appreciated.

As I understand it, you managed to generate this erroneous message from the CLI. Is this correct?

It would certainly help if Pat refused to post such messages to the outbox. It should also detect and ignore such messages (with a warning) if they ever appear in the outbox.

Regarding your reported issue no 2: Without seeing a full log output, it is hard to say for sure, but I suspect the error "Unable to save received message..." was sent by the CMS after it had received the block of messages containing the erroneous message. The link is typically disconnected after such errors, which is something Pat does not have control over. In the FBB protocol, message proposals and message transfers are sent in blocks of 5 between each link "turnover". Errors sent from the CMS immediately after** a session turnover are hard/impossible to automatically recover from, since they typically does not report which of the (potentially 5) messages caused the error.

I will look into all of these cases more closely, and hopefully include a fix in the next release.

ai6yr commented 7 years ago

Thanks for developing this on Linux. Yes, this was generated from the CLI.

Here's the various logs to help recreate this (sorry for not using attachments... copy/paste was easier). IZPZOEGS6Y7W.b2f.txt

kk6fut@kk6fut-laptop ~ $ pat compose From [KK6FUT]: To: Cc: Subject: Test Press ENTER to start composing the message body.

Attachment [empty when done]:

MID: IZPZOEGS6Y7W Date: 2017-08-07 15:04:00 -0700 PDT From: KK6FUT Subject: Test

Attachments:

Message posted kk6fut@kk6fut-laptop ~ $

After this is posted, this is the output from PAT on a Connect:

2017/08/07 15:05:04 Connecting to WL2K (telnet)... 2017/08/07 15:05:10 Connected to 10.96.124.141:8773 (tcp) [WL2K-3.2-B2FWIHJM$] ;PQ: 48459791 Halifax CMS >

FC EM IZPZOEGS6Y7W 190 169 0 Sending checksum 36 FS Y Remote accepted IZPZOEGS6Y7W Transmitting [Test] [offset 0] Test: 100% *** Unable to save received message - No 'to' or 'cc' addresses - Disconnecting (75.82.165.147) 2017/08/07 15:05:12 Exchange failed: Unable to save received message - No 'to' or 'cc' addresses - Disconnecting (75.82.165.147)

Finally, here's the output of pat read after sending the bad message: 0:in 1:out 2:sent 3:archive
Choose mailbox [n]: 1 panic: runtime error: index out of range

goroutine 1 [running]: main.printMessages(0x867f190, 0x18a0e0b0, 0x18a0ebe8, 0x1, 0x1) /home/martinhpedersen/go/src/github.com/la5nta/pat/read.go:123 +0x43b main.readMail() /home/martinhpedersen/go/src/github.com/la5nta/pat/read.go:53 +0x238 main.glob..func2(0x18a0eb80, 0x1, 0x1) /home/martinhpedersen/go/src/github.com/la5nta/pat/main.go:86 +0x17 main.main() /home/martinhpedersen/go/src/github.com/la5nta/pat/main.go:303 +0x680

martinhpedersen commented 7 years ago

Thank you 👍