/etc/cron.daily/apt assumes that CacheArchive inside CacheDir

Bug #565229 reported by Alexander Pyhalov
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Won't Fix
Low
Unassigned

Bug Description

Binary package hint: apt

cron apt script assumes that CacheArchive directory is inside CacheDir. However, apt allows configuration when CacheArchive is outside CacheDir (for example, I use it because of space shortage in /var).
Some changes to /etc/cron.daily/apt like this would be useful...

--- /etc/cron.daily/apt 2010-04-17 11:42:26.000000000 +0400
+++ tmp/apt 2010-04-17 11:45:38.000000000 +0400
@@ -181,7 +181,11 @@
  exit
     fi

- Cache="${Dir%/}/${CacheDir%/}/${CacheArchive%/}/"
+ if [ "x$CacheArchive" != "x${CacheArchive#/}" ]; then
+ Cache="${CacheArchive%/}/";
+ else
+ Cache="${Dir%/}/${CacheDir%/}/${CacheArchive%/}/";
+ fi

     # check age
     if [ ! $MaxAge -eq 0 ] && [ ! $MinAge -eq 0 ]; then
@@ -279,7 +283,13 @@
  return
     fi

- Cache="${Dir}/${CacheDir}/${CacheArchive}/"
+
+ if [ "x$CacheArchive" != "x${CacheArchive#/}" ]; then
+ Cache="${CacheArchive%/}/";
+ else
+ Cache="${Dir%/}/${CacheDir%/}/${CacheArchive%/}/";
+ fi
+
     Back="${Dir}/${CacheDir}/${CacheBackup}/"
     BackX="${Back}${CacheArchive}/"
     for x in $(seq 0 1 $((${BackupLevel}-1))); do

Revision history for this message
Torsten Spindler (tspindler) wrote :

The code for the cron job has changed since the bug was reported:

    Cache="/var/cache/apt/archives/"
    eval $(apt-config shell Cache Dir::Cache::archives/d)

Does this allow for the intended behaviour of having a CacheArchive outside of CacheDir?

Changed in apt (Ubuntu):
status: New → Incomplete
Revision history for this message
Alexander Pyhalov (alp-rsu) wrote :

Thanks, this fix works (however, it was not integrated in Ubuntu 10.04, which I use).

Revision history for this message
Torsten Spindler (tspindler) wrote :

Does the cron job from newer apt work on Ubuntu 10.04 LTS? Not sure if it's a SRU candidate as the problem doesn't seem to be that critical to me.

Changed in apt (Ubuntu):
status: Incomplete → Triaged
importance: Undecided → Low
Revision history for this message
Alexander Pyhalov (alp-rsu) wrote :

Yes, it works.

Revision history for this message
Torsten Spindler (tspindler) wrote :

Ok, I will close this bug as won't fix then, as I don't think the risk of a regression in the apt cron job is at the same level as the benefit of the fix.

Changed in apt (Ubuntu):
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.