[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#29654: Manual database index.db embeds timestamps
From: |
Ricardo Wurmus |
Subject: |
bug#29654: Manual database index.db embeds timestamps |
Date: |
Sat, 16 Dec 2017 01:35:12 +0100 |
User-agent: |
mu4e 0.9.18; emacs 25.3.1 |
Hi Ludo,
> I was already motivated to create the database directly from Scheme
> (‘man-db’ is quite slow), so that gave me an additional excuse. ;-)
>
> The attached patch does that. The timestamps are always set to zero.
That’s great!
> Unfortunately, this is not fully deterministic: when running --check
> several times in a row, I occasionally get different results. I suspect
> GDBM’s output is not fully deterministic.
Hmm, I dumped the contents of the generated databases with gdbm_dump and
couldn’t find any difference aside from the header (which is produced by
gdbm_dump itself). Diffoscope shows a lot of differences, though.
I thought that maybe the difference comes from the fact that upon adding
new entries gdbm grows the hash table. After setting the initial size
to a multiple of the number of entries I haven’t been able to generate a
non-reproducible database.
My only change is in “write-mandb-database”:
(gdbm-open file GDBM_WRCREAT #:block-size (* 512 (length entries)))
I tried this:
./pre-inst-env guix package -p foo -i coreutils guile
for i in `seq 30`; do ./pre-inst-env guix build --check -K
/gnu/store/pg3684khpj69py40v7p76b90r9q4j2lv-manual-database.drv; done
Seems fine. Coincidence or did I get lucky?
> +(define (entry->string entry)
> + "Return the wire format for ENTRY as a string."
> + (match entry
> + (($ <mandb-entry> file name section synopsis)
> + (string-append (abbreviate-file-name file) "\t"
> + (number->string section) "\t"
> + (number->string section)
> +
> + ;; Timestamps, that we always set to the epoch.
> + "\t0\t0"
> +
> + ;; XXX: Weird things.
> + "\tB\t-\t-\tgz\t"
What’s that?
--
Ricardo
GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
https://elephly.net