When run by a user without a fullname in the GECOS, such as:
user:x:1000:1000:,,,:/home/user:/bin/bash
Mail::Internet throws these errors:
Use of uninitialized value $name in pattern match (m//) at /usr/share/perl5/Mail/Internet.pm line 536.
Use of uninitialized value $name in sprintf at /usr/share/perl5/Mail/Internet.pm line 541.
The problem is these lines:
my $name = eval {local $SIG{__DIE__}; (getpwuid($>))[6]} || $ENV{NAME} ||"";
while($name =~ s/\([^\(\)]*\)//) { 1; }
# Strip extra fields: adduser-generated usernames have multiple comma
# seperated fields, only the first of which should be used to prevent
# accidental exposure of system-local information like phone numbers/
# room numbers.
$name = (split /,/, $name)[0];
if($name =~ /[^\w\s]/)
{ $name =~ s/"/\"/g;
$name = '"' . $name . '"';
}
my $from = sprintf "%s <%s>", $name, mailaddress();
$name is set equal to the first field of the GECOS, which is assumed to be
non-null; when it is not defined, the errors are thrown. I suppose there
should be tests for non-null values, and the code should only be executed for
defined fullnames.