Red Hat Enterprise Linux 5.6 to 5.9 upgrade broke perl scripts

Solution Unverified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL) 5.8 and later

Issue

  • Perl update breaks Perl scripts using AnyDBM_File module and not having a default fileset defined
  • After the upgrade from rhel5.6 to 5.9 at least one of our script stopped working.
  • The error $ ./script.sh: AnyDBM_File doesn't define an EXISTS method at /foo/bar/script.pl line 123) suggests problem with gdbm package.

Resolution

  • Define default fileset in the script.

    • For NDBM_File:
      • use NDBM_File;
    • For GDBM_File:
      • use GDBM_File;
    • For SDBM_File:
      • use SDBM_File;

Root Cause

  • In Perl version perl-5.8.8-38.el5 NDBM_File was reintroduced and also set as default fileset.
  • In previous Perl version, the default was set to GDBM_File which was supporting the EXISTS method to check whether a key exists in a database or not.
  • NDBM_File does not support EXISTS method and therefore scripts might fail with the above mentioned error message

Diagnostic Steps

  • Run the script on a system with Perl version perl-5.8.8-38.el5 or newer installed.
  • If the following error occurs, ensure a default fileset is defined in the script:
AnyDBM_File doesn't define an EXISTS method at script.pl

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.