eggheads / eggdrop

The Eggdrop IRC Bot
GNU General Public License v2.0
494 stars 88 forks source link

Fix share.mod feature negotiation between bots #1629

Open michaelortmann opened 1 week ago

michaelortmann commented 1 week ago

Found by: michaelortmann Patch by: michaelortmann Fixes:

One-line summary: Fix share.mod user file feature parser/checker

Additional description (if needed): Since eggdrop 1.8.1 the share.mod feature negotiation between bots is broken. Here we removed what looked like a surplus white space : https://github.com/eggheads/eggdrop/commit/afdd3a5e318ef2f6fa4ab7bc986d8a1960481314#diff-b39a75736674964b2c9de0f99a01ea3084f0a7d6288184e7dc98fe7ee075135e But the bots parser/checker depends on that very trailing space and drops the last feature, if the space is not seen So, this bug disables the last share.mod feature negotiated. For .console +gh the lines [03:21:30] {b<-BotB} uy exempts invites compress and [03:21:30] {b->BotB} feats exempts invites compress are associated. For a buggy bot, the last line would be without the last word: [04:13:06] {b->BotB} feats exempts invites If the last feature, like in this example is compress, then this bug disables compression for user file sharing, rendering the following config a noop:

loadmodule compress
set share-compressed 1

This PR fixes the parser.

Additionally, to be compatible to buggy bots (bots that have the buggy feature parser but at the same time send all feature flags), the trailing white space is re-added.

After adding the trailing whitespace, it didnt work with my eggdrop 1.9.5 testbot. Turns out, also the bug fixed with #1506 broke userfile sharing. So, fixing / testing is only possible for bots not effected by the bug fixed with #1506. eggdrop versions >= 1090200 and <= 1090504.

Test cases demonstrating functionality (if applicable): Link 2 share bots with

loadmodule compress
set share-compressed 1

Test 1: Active and passive share bots are the version equal to this PR Result:

[23:11:30] Uncompressing user file from BotA.
[23:11:30] Userfile loaded, unpacking...
[23:11:30] Userlist transfer complete; switched over.

Test2: Active share bot is the version equal to this PR, passive share bot is version after merge of #1506 which equals 6bc6560bc21063dc38b1fc5fa206facd3803d8ca Result:

[23:14:13] Uncompressing user file from BotA.
[23:14:13] Userfile loaded, unpacking...
[23:14:13] Userlist transfer complete; switched over.