summaryrefslogtreecommitdiff
path: root/test/integration
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2023-12-13 17:55:11 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2023-12-13 17:59:34 +0100
commit7b41275b9da31d6c87bbaa0c9115e224e47b15e1 (patch)
treec74b4a6f6a280a1a0f00a5976284d523342b096f /test/integration
parentc555d8f1ae31d1f511bf811640423231b75a8e13 (diff)
Do not silently ignore directories for reserved file names
Files with reserved extensions like .list, .sources, .conf, and .pref should receive notices in their respective directories even if they are directories.
Diffstat (limited to 'test/integration')
-rwxr-xr-xtest/integration/test-ignored-files43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/integration/test-ignored-files b/test/integration/test-ignored-files
new file mode 100755
index 000000000..90defdcd4
--- /dev/null
+++ b/test/integration/test-ignored-files
@@ -0,0 +1,43 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+
+setupenvironment
+configarchitecture 'amd64'
+
+setupaptarchive --no-update
+
+testsuccessequal "Reading package lists...
+Building dependency tree...
+All packages are up to date." apt update -q
+
+
+msgtest "Check notices about .list and .sources directories in sources.list.d"
+mkdir rootdir/etc/apt/sources.list.d/a-dir-that-will-be-ignored
+mkdir rootdir/etc/apt/sources.list.d/a-dir-that-will-be-ignored.conf
+mkdir rootdir/etc/apt/sources.list.d/a-dir-that-will-not-be-ignored.list
+mkdir rootdir/etc/apt/sources.list.d/a-dir-that-will-not-be-ignored.sources
+testsuccessequal "Reading package lists...
+Building dependency tree...
+All packages are up to date.
+N: Ignoring 'a-dir-that-will-not-be-ignored.list' in directory '${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/' as it is not a regular file
+N: Ignoring 'a-dir-that-will-not-be-ignored.sources' in directory '${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/' as it is not a regular file" apt update
+rmdir rootdir/etc/apt/sources.list.d/a-dir-*
+
+msgtest "Check for notices about .conf directories in apt.conf.d"
+mkdir -p rootdir/etc/apt/apt.conf.d/a-dir-that-will-be-ignored
+mkdir -p rootdir/etc/apt/apt.conf.d/a-dir-that-will-be-ignored.list
+mkdir -p rootdir/etc/apt/apt.conf.d/a-dir-that-will-not-be-ignored.conf
+testsuccessequal "N: Ignoring 'a-dir-that-will-not-be-ignored.conf' in directory '${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/' as it is not a regular file" aptconfig shell
+rmdir rootdir/etc/apt/apt.conf.d/a-dir-*
+
+msgtest "Check for directory notices in preferences.d"
+mkdir -p rootdir/etc/apt/preferences.d/a-dir-that-will-be-ignored
+mkdir -p rootdir/etc/apt/preferences.d/a-dir-that-will-be-ignored.conf
+mkdir -p rootdir/etc/apt/preferences.d/a-dir-that-will-not-be-ignored.pref
+testsuccessequal "Package files:
+Pinned packages:
+N: Ignoring 'a-dir-that-will-not-be-ignored.pref' in directory '${TMPWORKINGDIRECTORY}/rootdir/etc/apt/preferences.d/' as it is not a regular file" apt policy
+rmdir rootdir/etc/apt/preferences.d/a-dir-*