diff options
| author | Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm> | 2026-03-19 20:13:55 +0100 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2026-05-01 16:12:00 +0000 |
| commit | dcc690d7e08f6d54fc10ee372510875a41ec9a3b (patch) | |
| tree | f3aa3be72868832a2e9fb69806421fc3741f9943 /apt-pkg/acquire-item.cc | |
| parent | 98cfa47c7437da0cf3fbb89aec9f38ea70d0a5de (diff) | |
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
Diffstat (limited to 'apt-pkg/acquire-item.cc')
| -rw-r--r-- | apt-pkg/acquire-item.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index ca649a4b8..458868bec 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -870,6 +870,10 @@ std::string pkgAcquire::Item::ShortDesc() const /*{{{*/ return DescURI(); } /*}}}*/ +void pkgAcquire::Item::Cancelled() /*{{{*/ +{ +} + /*}}}*/ void pkgAcquire::Item::Finished() /*{{{*/ { } @@ -2006,6 +2010,12 @@ string pkgAcqMetaClearSig::Custom600Headers() const return Header; } /*}}}*/ +void pkgAcqMetaClearSig::Cancelled() /*{{{*/ +{ + if (TransactionManager->State == TransactionStarted) + TransactionManager->AbortTransaction(); +} + /*}}}*/ void pkgAcqMetaClearSig::Finished() /*{{{*/ { if(_config->FindB("Debug::Acquire::Transaction", false) == true) |
