Version in base suite: 1.4.18-3 Base version: xapian-core_1.4.18-3 Target version: xapian-core_1.4.18-3+deb11u1 Base file: /srv/ftp-master.debian.org/ftp/pool/main/x/xapian-core/xapian-core_1.4.18-3.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/x/xapian-core/xapian-core_1.4.18-3+deb11u1.dsc changelog | 12 +++++++++ patches/fix-db-corruption-on-ENOSPC.patch | 40 ++++++++++++++++++++++++++++++ patches/series | 1 3 files changed, 53 insertions(+) diff -Nru xapian-core-1.4.18/debian/changelog xapian-core-1.4.18/debian/changelog --- xapian-core-1.4.18/debian/changelog 2021-02-23 18:33:41.000000000 +0000 +++ xapian-core-1.4.18/debian/changelog 2023-03-16 22:20:07.000000000 +0000 @@ -1,3 +1,15 @@ +xapian-core (1.4.18-3+deb11u1) bullseye; urgency=medium + + * debian/patches/fix-db-corruption-on-ENOSPC.patch: New patch to + fix potential database corruption if switching the new revision + live fails with ENOSPC but the recovery process does NOT get ENOSPC. + The fix here is taken from upstream's 1.4.22 release and is the simplest + way to address the problem: simply reread the current version file + from disk which means the in memory state will match the previously + committed state. Closes: #1032398 + + -- Olly Betts Fri, 17 Mar 2023 11:20:07 +1300 + xapian-core (1.4.18-3) unstable; urgency=medium * debian/rules: Workaround testcase sensitivity to excess precision by diff -Nru xapian-core-1.4.18/debian/patches/fix-db-corruption-on-ENOSPC.patch xapian-core-1.4.18/debian/patches/fix-db-corruption-on-ENOSPC.patch --- xapian-core-1.4.18/debian/patches/fix-db-corruption-on-ENOSPC.patch 1970-01-01 00:00:00.000000000 +0000 +++ xapian-core-1.4.18/debian/patches/fix-db-corruption-on-ENOSPC.patch 2023-03-16 22:20:07.000000000 +0000 @@ -0,0 +1,40 @@ +commit 90f7a35483b4cf7dd848c34634803bf28f95081d +Author: Olly Betts +Date: Wed Jan 25 11:40:44 2023 +1300 + + Fix recovery from failed commit + + If renaming to switch the new version file live fails (e.g. due to + ENOSPC) we discard the changes, try to write and switch to a different + new version file with an increased revision (on failure of this too we + close the database), and throw DatabaseError. + + Unfortunately the roll-back of state is not complete, and if switching + to the different new version file succeeds that bad state persists on + disk. + + Thanks to Uwe Kleine-König for reporting and coming up with the idea + to reproduce using strace to inject a rename() failure - this is a + simple reproducer: + + rm -rf enospc.db + strace -e inject=rename:error=ENOSPC:when=2 examples/simpleindex enospc.db < INSTALL + xapian-check enospc.db + + No automated regression test for this yet as this doesn't trivially + fit into the existing testsuite framework, but we ought to have + tests using fault injection. + + (cherry picked from commit 9f9aad17893bde4acb3a98e60dde397c346fcd9a) + +--- a/backends/glass/glass_database.cc ++++ b/backends/glass/glass_database.cc +@@ -619,7 +619,7 @@ + cancel(); + + // Reopen tables with old revision number. +- version_file.cancel(); ++ version_file.read(); + docdata_table.open(flags, version_file.get_root(Glass::DOCDATA), old_revision); + spelling_table.open(flags, version_file.get_root(Glass::SPELLING), old_revision); + synonym_table.open(flags, version_file.get_root(Glass::SYNONYM), old_revision); diff -Nru xapian-core-1.4.18/debian/patches/series xapian-core-1.4.18/debian/patches/series --- xapian-core-1.4.18/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ xapian-core-1.4.18/debian/patches/series 2023-03-16 22:20:07.000000000 +0000 @@ -0,0 +1 @@ +fix-db-corruption-on-ENOSPC.patch