[pkg-db-devel] Bug#652036: db: Salvaging db_dump triggers endless loop on certain broken databases since Berkeley DB 4.7

Stephan Sürken absurd at debian.org
Wed Dec 14 11:55:39 UTC 2011


Source: db
Severity: normal
Tags: upstream patch

Dear Maintainer,

when you happen to have a (BTREE) Berkeley DB (w/o environment)
broken in a certain way [1][2], trying a salvage dump like so

db4.8_dump -r -f database.dump database.db

leads to an endless loop inside libdb in all Berkeley DB
versions >= 4.7.

This is due to the attached upstream patch [3]; reversing this
patch "fixes" the issue, and it works again (like in Berkeley DB
4.4).

I am not at all into Berkeley DB internals, however I guess the
introduced loop misses a guard against "pageno"s
loop-referencing (same two pagenos usually reappear enlessly
when debugging).

Reverting the patch definitely fixes a regression for my use
case. Don't know what it might break, though.

Hope you can forward this upstream, and/or maybe considering a
Debian patch for this.

Thanks!

Stephan

--
[1] The attached database.db is such an example.
[2] The attached tar.gz has a program to create "suchly broken"
dbs -- basically an unclean shutdown after a number of put() and
del() does the trick. To use it, try
 ? make
 ? make find-broken
[3] The attached patch shows the loop introduced in 4.7 upstream.

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
-------------- next part --------------
A non-text attachment was scrubbed...
Name: database.db
Type: application/octet-stream
Size: 2314240 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-db-devel/attachments/20111214/aae8f03d/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Kapott.tar.gz
Type: application/x-gzip
Size: 2156 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-db-devel/attachments/20111214/aae8f03d/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: db46to47_endless_loop.patch
Type: text/x-diff
Size: 1086 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-db-devel/attachments/20111214/aae8f03d/attachment-0001.patch>


More information about the pkg-db-devel mailing list