ruby / ruby/net-pop

When retrieving UIDL with POP, data sometimes goes missing.

Open
#27 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
33
Forks
14
PR merge metrics
No merged PRs in 30d

Description

Hello,

Thank you for your continuous contributions to Ruby. I am using this library for work, and I have encountered a peculiar issue where UIDLs are sometimes missing.

I attempted to address this with the following patch:

diff --git a/lib/net/pop.rb b/lib/net/pop.rb
index d4ee8f8..d56a270 100644
--- a/lib/net/pop.rb
+++ b/lib/net/pop.rb
@@ -969,6 +969,7 @@ module Net
           getok('UIDL')
           table = {}
           @socket.each_list_item do |line|
+            pp "bad size #{line} #{line.split(' ').size}" if line.split(' ').size != 2
             num, uid = line.split(' ')
             table[num.to_i] = uid
           end

The results were as follows:

"bad size 588 UID794684-1450674668\r\n" + "589 UID794685-1450674668 4"
"bad size 3789 UID797886-1450674668\r\n" + "3790 UID797887-1450674668 4"
"bad size 7885 UID801982-1450674668\r\n" + "7886 UID801983-1450674668 4"

It seems that the delimiter is being ignored during the reading process. Although it appears that the socket is implemented to read up to \r\n as seen here:
https://github.com/ruby/ruby/blob/c0938fd24c927954dbe5d42e70844b6a89516786/lib/net/protocol.rb#L387

However, it seems this is being ignored. This is quite peculiar, and I am wondering if you have any ideas about this issue. If not, I am considering some potential solutions.

Thank you for your assistance.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/net/pop.rb around the UIDL retrieval code and compare its line handling with the referenced reader in lib/net/protocol.rb at line 387. Reproduce the reported multi-entry behavior and determine why a UIDL record can combine adjacent lines; done means UIDL retrieval retains every record without losing entries.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.