Subject: bug#59135: Receiving large files with ERC-DCC

From: "J.P." <[email-masked]>
Date: Wed, 09 Nov 2022 06:00:35 -0800

Hi Tohiko,

Tohiko Looka <[email-masked]> writes:

> When receiving large files with ERC-DCC I get  the error
>
> ERC-DCC (erc-pack-int): packet too large

What version of Emacs and ERC is this? If you have the command
`erc-bug', please consider using it to prepare ERC bug reports in the
future.

> incessantly which makes Emacs unresponsive until eventually the IRC
> server connection is closed.

That sounds like a bug. The process should probably be killed before the
error is signaled.

> I believe this happens when the file size is larger than 2 or 4 GB
> which does not fit in an integer.

Right. Desktops were mostly 32 bits back when DCC was a thing, and the
protocol reflects that.

> This causes a failure when the function erc-dcc-get-filter tries to
> send back the number of received bytes.
>
> Is there a way around this?

It depends on the file sender. If they're actually verifying your
reports, then you're out of luck because who's to say how reporting
should proceed on either side, post-overflow? IOW, if the reporter (file
receiver) wants to send 5- or 8-byte reports or wrap back around, that
needs to be coordinated beforehand with the other party (the file
sender).

Now, there *is* a variation of the protocol that ERC doesn't officially
support but that it has nevertheless partially implemented (a flavor of,
anyway). Check with the sender and see if they're operating in so-called
"turbo" mode (sometimes called TSEND). I've heard that some senders
enable it implicitly but don't announce that fact (if they're even aware
of having done so).

Regardless, if ERC thinks it's in a turbo-aware conversation, it won't
send reports at all. You can toggle this behavior with the -t switch
starting in Emacs 29.1. See the command usage in the ;;; Commentary
section in erc-dcc.el [1] and maybe some related variables further down
[2]. There's also bug#54458 [3], which gave rise to that feature. Hope
that helps.

Thanks,
J.P.

[1] https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/erc/erc-dcc.el?id=1f29ee2d#n46
[2] https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/erc/erc-dcc.el?id=1f29ee2d#n979
[3] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54458