From dcc690d7e08f6d54fc10ee372510875a41ec9a3b Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Thu, 19 Mar 2026 20:13:55 +0100 Subject: pkgAcqMetaClearSig: Abort transaction when pkgAcquire::Run has been cancelled Ongoing Run can be cancelled by returning false from ::Pulse(). In this case the items would still be called pkgAcquire::Item::Finished() as usual, causing pkgAcqMetaClearSig to commit the incomplete transaction anyway as at that point it's still Started and has no errors. Add a pkgAcquire::Item::Cancelled() method and use it in pkgAcqMetaClearSig to abort the transaction. Closes: #1078608 --- apt-pkg/acquire-item.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'apt-pkg/acquire-item.h') diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index 5861d48be..1182e415e 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -253,6 +253,9 @@ class APT_PUBLIC pkgAcquire::Item : public WeakPointable /*{{{*/ */ virtual std::string ShortDesc() const; + /** \brief Invoked by the worker when the download is cancelled before completion. */ + virtual void Cancelled(); + /** \brief Invoked by the worker when the download is completely done. */ virtual void Finished(); @@ -575,6 +578,7 @@ class APT_HIDDEN pkgAcqMetaClearSig final : public pkgAcqMetaIndex bool VerifyDone(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override; void Done(std::string const &Message, HashStringList const &Hashes, pkgAcquire::MethodConfig const *Cnf) override; + void Cancelled() override; void Finished() override; /** \brief Starts downloading the individual index files. -- cgit v1.2.3-70-g09d2