CentOS/RHEL x86_64 + VMWare: Use of uninitialized value in string

I was working with a CentOS 5 x86_64 installation running VMWare server last week when I stumbled upon this error:

Use of uninitialized value in string eq at /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/VMware/VmPerl.pm line 114.

You can run the vmware-cmd application with this error (it's not a fatal error) and keep going with your normal business. However, if you want to remove the error, comment out lines 114 and 115 in the Perl module referenced by the error:

die "Perl API Version does not match dynamic library version."
    unless (version() eq $VERSION);

Commenting out these lines does not affect the VMWare server in any way.

Printed from: http://rackerhacker.com/2008/09/03/centosrhel-x86_64-vmware-use-of-uninitialized-value-in-string/ .
© Major Hayden 2012.

2 Comments   »

  • BigJoe says:

    This assumption is probably true that this won't cause any errors. But after patching and upgrading this could come up to haunt you. This is essentially dying because one or both of the two values in evaluation are not defined. A potentially safer way to fix this is to add the following can make a minor change:

    $VERSION = "0" if(! defined($VERSION));
    my $APIVERSION = version();
    $APIVERSION = "0" if(! defined($APIVERSION));

    die "Perl API Version does not match dynamic library version."
    unless ($APIVERSION eq $VERSION);

    Sorry for my randomly nuts rant but this error is one of my biggest pet peeves from maintaining and troubleshooting existing Perl code. It bugs me even more that code like this is distributed and generates all these errors making administrators think that all Perl code is buggy or unstable.

  • Andy says:

    Thanks BigJoe.

    Watch out though, folks. The text above includes those pesky 'smart double quotes', not real double-quotes, so you'll need to replace the incorrect double-quotes with correct ones when you paste this snippet in to the Perl module.

RSS feed for comments on this post

Leave a Reply

 

  • Welcome! I started this blog as a way to give back to all of the other system administrators who have taught me something in the past. Writing these posts brings me a lot of enjoyment and I hope you find the information useful. If you spot something that's incorrect or confusing, please write a comment and let me know. Drop me a line if there's something you want to know more about and I'll do my best to write a post on the topic.
    -- Major Hayden

    Flattr this