[Bug 2067138] Re: Dir::Cache=/dev/null chmods /dev/null

Launchpad Bug Tracker 2067138 at bugs.launchpad.net
Sat Jun 15 18:16:49 UTC 2024


This bug was fixed in the package apt - 2.9.5

---------------
apt (2.9.5) unstable; urgency=medium

  [ Julian Andres Klode ]
  * CI: Set /bin/sh shell for travis user, so flock -c works
  * Fix test cases for non-amd64 architectures
  * edsp: Parse source version from the Source-Version field
  * Check gpgv --dump-options for --assert-pubkey-algo support.
    Thanks to Justus Winter for the idea
  * Make the failure mode for non-executable tests stronger
  * solver3: Do not dump sizes that are clearly pointers
  * solver3: Group work items
  * solver3: Remove no longer necessary comparisons
  * solver3: Order obsolete choices last

  [ Noah Meyerhans ]
  * Fix spelling of @SNAPSHOTID@ in apt.conf.5.xml (Closes: #1072189)

  [ Frans Spiesschaert ]
  * Dutch program translation update (Closes: #1072493)
  * Dutch manpages translation update (Closes: #1072494)

 -- Julian Andres Klode <jak at debian.org>  Thu, 13 Jun 2024 21:04:40
+0200

** Changed in: apt (Ubuntu)
       Status: New => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to apt in Ubuntu.
https://bugs.launchpad.net/bugs/2067138

Title:
  Dir::Cache=/dev/null chmods /dev/null

Status in apt package in Ubuntu:
  Fix Released

Bug description:
  [Impact]
  If you set Dir::Cache or Dir::Cache::pkgcache to /dev/null, /dev/null is chmodded as we chmod the cache file to 666. This is a semi-common pattern to not use a cache, and breaks user scripts.

  [Test plan]
  1. autopkgtests run the large integration test suite 
  2. run manually
     apt-cache gencaches -o Dir::Cache::pkgcache=/dev/null
     apt-cache gencaches -o Dir::Cache::srcpkgcache=/dev/null
     apt-cache gencaches -o Dir::Cache=/dev/null
     and observe that /dev/null is still correct.

  [Where problems could occur]
  We have eliminated writing the cache to /dev/null entirely:

  --- a/apt-pkg/pkgcachegen.cc
  +++ b/apt-pkg/pkgcachegen.cc
  @@ -1637,6 +1637,10 @@ static DynamicMMap* CreateDynamicMMap(FileFd * const CacheF, unsigned long Flags
   static bool writeBackMMapToFile(pkgCacheGenerator * const Gen, DynamicMMap * const Map,
         std::string const &FileName)
   {
  +   // Do not write the file back to /dev/null or try to change its mode...
  +   if (FileName == "/dev/null")
  +      return true;

  It's possible we may introduce issues later because something in there
  does fancy bits and the cache in memory becomes invalid, but so far I
  only saw that we calculate the hash in there, but we set dirty
  afterwards and don't actually use the cache hash if we don't load from
  disk so I think in reality this is not a problem, at least now. Just
  gotta be careful to not stuff anything other than writing in there.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/2067138/+subscriptions




More information about the foundations-bugs mailing list