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

Bug#194467: apt: apt-get install should lock the list directory



Package: apt
Version: 0.5.5.1
Severity: normal
Tags: patch

The apt should lock the list directory when will install some package
this access the cache and the update change this so both cannot be
called together.

The patch bellow solve this:

Index: cmdline/apt-get.cc
===================================================================
RCS file: /cvs/deity/apt/cmdline/apt-get.cc,v
retrieving revision 1.130
diff -u -r1.130 apt-get.cc
--- cmdline/apt-get.cc  19 May 2003 17:30:12 -0000      1.130
+++ cmdline/apt-get.cc  23 May 2003 16:37:51 -0000
@@ -1315,6 +1315,15 @@
 /* Install named packages */
 bool DoInstall(CommandLine &CmdL)
 {
+   // Lock the list directory
+   FileFd Lock;
+   if (_config->FindB("Debug::NoLocking",false) == false)
+   {
+      Lock.Fd(GetLock(_config->FindDir("Dir::State::Lists") + "lock"));
+      if (_error->PendingError() == true)
+        return _error->Error(_("Unable to lock the list directory"));
+   }
+   
    CacheFile Cache;
    if (Cache.OpenForInstall() == false || 
        Cache.CheckDeps(CmdL.FileSize() != 1) == false)

Thanks,
Otavio

-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux retteb.casa 2.4.21-rc1-ac3 #1 Sáb Mai 3 14:31:45 BRT 2003 i686
Locale: LANG=en_US.ISO-8859-1, LC_CTYPE=en_US.ISO-8859-1

Versions of packages apt depends on:
ii  libc6                         2.3.1-17   GNU C Library: Shared libraries an
ii  libgcc1                       1:3.3-2    GCC support library
ii  libstdc++5                    1:3.3-2    The GNU Standard C++ Library v3

-- no debconf information




Reply to: