[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#433007: [patch] writeStateFile should not be called in dry-run mode



found 433007 0.7.21
thanks

The patch proposed by Chanoch Bloom stops the execution of writeStateFile
then APT is in dry-run mode, but in bug #498799 it is mentioned that adding
checks against APT config items in the generic libapt is discouraged and
i guess the patch was therefore rejected without further notice.

Solution: apt-get should not call writeStateFile() in dry-run mode at all.
apt-get call this method only once, so the new patch is as simple as the
old patch and should apply fine against current debian-sid branch.
(btw: the patch is also available in my very experimental branch on launchpad)

Example: (assume python-apt is automatically installed)
=== without patch ===
$ LANG=en apt-get install python-apt -s -o "Debug::NoLocking=1"
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-apt is already the newest version.
python-apt set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 63 not upgraded.
E: Failed to write temporary StateFile /var/lib/apt/extended_states.tmp

=== with patch ===
$ LANG=en apt-get install python-apt -s -o "Debug::NoLocking=1"
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-apt is already the newest version.
python-apt set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 63 not upgraded.

thanks for reading and sorry for the mistakes i surely made -
but please be nice, it's my first time. ;)
(btw: no need to cc me - i am subscript to the mailing list)


Best regards / Mit freundlichen Grüßen,

David "DonKult" Kalnischkies
=== modified file 'cmdline/apt-get.cc'
--- cmdline/apt-get.cc	2009-04-14 12:17:40 +0000
+++ cmdline/apt-get.cc	2009-05-19 18:47:39 +0000
@@ -1870,7 +1870,8 @@
    // cache.commit()
    if (AutoMarkChanged > 0 &&
        Cache->DelCount() == 0 && Cache->InstCount() == 0 &&
-       Cache->BadCount() == 0)
+       Cache->BadCount() == 0 &&
+       _config->FindB("APT::Get::Simulate",false) == false)
       Cache->writeStateFile(NULL);
 
    // See if we need to prompt


Reply to: