From dffc17ba835b6bf782fe553d338b6a921c6de7bf Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 14 Dec 2015 03:21:20 +0100 Subject: non-existing directories don't need to be cleaned Trying to clean up directories which do not exist seems rather silly if you think about it, so let apt think about it and stop it. Depends a bit on the caller if this is fixing anything for them as they might try to acquire a lock or doing other clever things as apt does. Closes: 807477 --- test/integration/test-apt-get-clean | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'test/integration/test-apt-get-clean') diff --git a/test/integration/test-apt-get-clean b/test/integration/test-apt-get-clean index 00f9d4e60..78cb95d74 100755 --- a/test/integration/test-apt-get-clean +++ b/test/integration/test-apt-get-clean @@ -36,4 +36,26 @@ testfailure test -e rootdir/var/cache/apt/archives/foo_2_all.deb testfailure test -e rootdir/var/cache/apt/archives/foo_3_all.deb testfailure test -e rootdir/var/cache/apt/archives/foo_4_all.deb - +directorygone() { + rm -rf "$1" + testsuccess apt autoclean + testfailure test -d "$1" + testsuccess apt clean + # clean creates an empty partial directory via GetLock + if [ "$(basename "$1")" = 'partial' ]; then + testsuccess test -d "$1" + else + testfailure test -d "$1" + fi +} +msgmsg 'Partial directory missing' +directorygone 'rootdir/var/cache/apt/archives/partial' +directorygone 'rootdir/var/lib/apt/lists/partial' + +msgmsg 'Archives directory missing' +directorygone 'rootdir/var/cache/apt/archives' +directorygone 'rootdir/var/lib/apt/lists' + +msgmsg 'apt directory missing' +directorygone 'rootdir/var/cache/apt' +directorygone 'rootdir/var/lib/apt' -- cgit v1.2.3