Four years ago I made a DBM file (.dir/.pag pair) for an academic project, and now I can't get the data back out.

I'm guessing the problem is a mismatch between the DBM-handling routine it was written with and the ones I'm trying to read it with, but I don't know how to find out what to use that will be able to make proper sense of the .dir : the best I can get so far is seeing some truncated value data smashed into a key value, as returned.

At the time I was on an Athena system, which I believe is a version of Berkely Unix; now I'm working on my web-hoster's Linux system (ver2.2 or higher, as far as I can tell). Both have/had professional sysadmins maintaining the Perl installations.

The keys are short strings (usernames). The values are long strings with many values glued together with a '::' separator: the first value is a short string password, the second is a 3-digit ID number, the rest are time()stamps appended as a log.

Matching those logs-of-timestamps to the usernames is what I'm desperately in need of solving.

Some plain-text exploration in the large .pag file shows lots of that kind of data there, but also lots of wierd binary sections and jumbled ordering, as one might expect.

I've tried useing each of AnyDBM_File and it's referants: NDBM_File, DB_File, GDBM_File, ODBM_File, and SDBM_File separately (with diagnostics).

I'm using dbmopen (because the arguments to tie confuse me) with the third argument undef to prevent the existing files from being overwritten by an open attempt. The keys are being retrieved with each()

Here are the results:

AnyDBM, NDBM, and GDBM produce uncaught errors, period, end execution.
ODBM stops execution after a terse complaint of a segmentation fault.
DB_File stops execution after complaining (twice) of an unititalized value in subroutine entry at line 263 (from a perl 5.6.1 directory/.pm file).
SDBM manages to sometimes produce output: the first key (prefaced by a little garbage) includes both key and value info for the first entry I can see opening the file as plaintext, all the values are blank, and the subsequent keys are either large garbage (including some of the module code or its state) or completely blank, and eventually produce an out of memory error.

Please, oh please, ye wise monks, where can a Novice brother like myself turn to untangle this recalcitrant pair of DBM files?


In reply to Unwinding an (unknown type) DBM by mendicantMatt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.