]> git.saurik.com Git - apt.git/commitdiff
ignore lost+found in private directory cleanup
authorDavid Kalnischkies <david@kalnischkies.de>
Thu, 19 Nov 2015 15:19:15 +0000 (16:19 +0100)
committerDavid Kalnischkies <david@kalnischkies.de>
Thu, 19 Nov 2015 16:56:07 +0000 (17:56 +0100)
In ce1f3a2c we started warning about failing unlinking, which we
consistently do for directories. That isn't a problem as directories
usually aren't in the places we do want to clean up – with the potential
exeception of "lost+found", so lets ignore it like we ignore our own
partial/ subdirectory.

Closes: 805424
apt-pkg/acquire.cc
apt-pkg/clean.cc
methods/mirror.cc
test/integration/framework
test/integration/test-apt-get-clean

index fb1210750f41b3b2699be4e9c9e5d50ccc64662e..e61f4192d6c30745de7d91316f0d9e5d28f20a81 100644 (file)
@@ -688,6 +688,7 @@ bool pkgAcquire::Clean(string Dir)
       // Skip some files..
       if (strcmp(Dir->d_name,"lock") == 0 ||
          strcmp(Dir->d_name,"partial") == 0 ||
+         strcmp(Dir->d_name,"lost+found") == 0 ||
          strcmp(Dir->d_name,".") == 0 ||
          strcmp(Dir->d_name,"..") == 0)
         continue;
index ebe8a8a530569ad5df7f80d49e5754bac23c41dd..8e6bd625529f9cdfff91a55f01570c8a0257eebe 100644 (file)
@@ -54,6 +54,7 @@ bool pkgArchiveCleaner::Go(std::string Dir,pkgCache &Cache)
       // Skip some files..
       if (strcmp(Dir->d_name,"lock") == 0 ||
          strcmp(Dir->d_name,"partial") == 0 ||
+         strcmp(Dir->d_name,"lost+found") == 0 ||
          strcmp(Dir->d_name,".") == 0 ||
          strcmp(Dir->d_name,"..") == 0)
         continue;
index 56362d317a9dfc499f56f3fa5803456fbfbbe197..01eed09f0fe2999846a662341305cb52ea011a8b 100644 (file)
@@ -106,6 +106,7 @@ bool MirrorMethod::Clean(string Dir)
       // Skip some files..
       if (strcmp(Dir->d_name,"lock") == 0 ||
          strcmp(Dir->d_name,"partial") == 0 ||
+         strcmp(Dir->d_name,"lost+found") == 0 ||
          strcmp(Dir->d_name,".") == 0 ||
          strcmp(Dir->d_name,"..") == 0)
         continue;
index 7a56a9acd08c202051b08baed1f017b7e800e876..de8a65d7a74b930b7a4ac34cacd1d45f9fe7610c 100644 (file)
@@ -1766,8 +1766,8 @@ listcurrentlistsdirectory() {
 ### convenience hacks ###
 mkdir() {
        # creating some directories by hand is a tedious task, so make it look simple
-       if [ "$*" = '-p rootdir/var/lib/apt/lists' ] || [ "$*" = "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" ] ||
-          [ "$*" = '-p rootdir/var/lib/apt/lists/partial' ] || [ "$*" = "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" ]; then
+       local PARAMS="$*"
+       if [ "$PARAMS" != "${PARAMS#*rootdir/var/lib/apt/lists}" ]; then
                # only the last directory created by mkdir is effected by the -m !
                command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt"
                command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"
index 31e9900c9286358c00b4250a08c958859c60cdf8..00f9d4e60cae7bc7026df1a84d9bc968e3dfda2f 100755 (executable)
@@ -11,7 +11,10 @@ insertpackage 'testing' 'foo' 'all' '1'
 insertpackage 'unstable' 'foo' 'all' '2'
 insertinstalledpackage 'foo' 'all' '3'
 
-setupaptarchive
+setupaptarchive --no-update
+
+mkdir -p rootdir/var/lib/apt/lists/lost+found
+testsuccess apt update
 
 # nothing to do always works
 testsuccess aptget clean
@@ -19,7 +22,7 @@ testsuccess aptget clean -s
 
 # generate some dirt and clean it up
 touch rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en
-mkdir -p rootdir/var/cache/apt/archives
+mkdir -p rootdir/var/cache/apt/archives/lost+found
 touch rootdir/var/cache/apt/archives/foo_1_all.deb
 touch rootdir/var/cache/apt/archives/foo_2_all.deb
 touch rootdir/var/cache/apt/archives/foo_3_all.deb