Subject: | "Use of uninitialized value in hash element" in fetch_hash() |
While checking the logs of an imapsync migration, I noticed an "Use of uninitialized value in hash element" every now and then. For example:
Jun 29 13:39:08 zmsync zmimapsync/user@example.com[19803]: 13/29 [INBOX] -> [INBOX]
Jun 29 13:39:08 zmsync zmimapsync/user@example.com[19803]: cache directory: /srv/imapsync/zmimapsync/spool/user@example.com/imapsync_cache/mail.example.com/user@example.com/z
mmbx2.example.com/user@example.com/INBOX/INBOX
Jun 29 13:39:08 zmsync zmimapsync/user@example.com[19803]: CACHE h1 h2: 9939 files
Jun 29 13:39:08 zmsync zmimapsync/user@example.com[19803]: Use of uninitialized value in hash element at /usr/share/perl5/vendor_perl/Mail/IMAPClient.pm line 2245.
Jun 29 13:39:08 zmsync zmimapsync/user@example.com[19803]: Use of uninitialized value in hash element at /usr/share/perl5/vendor_perl/Mail/IMAPClient.pm line 2245.
Jun 29 13:39:08 zmsync zmimapsync/user@example.com[19803]: Use of uninitialized value in hash element at /usr/share/perl5/vendor_perl/Mail/IMAPClient.pm line 2245.
Jun 29 13:39:08 zmsync zmimapsync/user@example.com[19803]: Use of uninitialized value in hash element at /usr/share/perl5/vendor_perl/Mail/IMAPClient.pm line 2245.
Jun 29 13:39:08 zmsync zmimapsync/user@example.com[19803]: Use of uninitialized value in hash element at /usr/share/perl5/vendor_perl/Mail/IMAPClient.pm line 2245.
Jun 29 13:39:08 zmsync zmimapsync/user@example.com[19803]: Use of uninitialized value in hash element at /usr/share/perl5/vendor_perl/Mail/IMAPClient.pm line 2245.
Jun 29 13:39:08 zmsync zmimapsync/user@example.com[19803]: msg INBOX/387988 {44866} copied to INBOX/25523 0.04 msgs/s 1.519 KiB/s 2.729 MiB copied
Jun 29 13:39:08 zmsync zmimapsync/user@example.com[19803]: msg INBOX/387989 {106653} copied to INBOX/25524 0.04 msgs/s 1.576 KiB/s 2.836 MiB copied
Jun 29 13:39:08 zmsync zmimapsync/user@example.com[19803]: msg INBOX/387990 {17007} copied to INBOX/25525 0.04 msgs/s 1.591 KiB/s 2.863 MiB copied
Jun 29 13:39:08 zmsync zmimapsync/user@example.com[19803]: msg INBOX/387992 {20508} copied to INBOX/25526 0.04 msgs/s 1.609 KiB/s 2.895 MiB copied
Jun 29 13:39:08 zmsync zmimapsync/user@example.com[19803]: msg INBOX/387993 {50132} copied to INBOX/25527 0.04 msgs/s 1.635 KiB/s 2.949 MiB copied
Jun 29 13:39:08 zmsync zmimapsync/user@example.com[19803]: msg INBOX/387994 {23833} copied to INBOX/25528 0.04 msgs/s 1.652 KiB/s 2.982 MiB copied
The affected code is in fetch_hash:
# NOTE: old code tried to remove any "unrequested" data in $entry
# - UID is sometimes not explicitly requested, are there others?
if ( $self->Uid ) {
$uids->{ $entry->{UID} } = $entry; # <--
delete $entry->{UID} unless $asked_for_uid;
}
else {
$uids->{$mid} = $entry;
}
So somehow every now and then $entry->{UID} is undef. Which should be impossible unless the magic regexp above fails. This is a migration from Exchange 2013 so maybe that one is misbehaving.
I'll see if I can trigger the issue on a debug run but that's all I have right now.