aboutsummaryrefslogtreecommitdiff
path: root/scripts/testing/maint-scenarios/23-pacnew-delete.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/testing/maint-scenarios/23-pacnew-delete.sh')
-rw-r--r--scripts/testing/maint-scenarios/23-pacnew-delete.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/testing/maint-scenarios/23-pacnew-delete.sh b/scripts/testing/maint-scenarios/23-pacnew-delete.sh
new file mode 100644
index 0000000..23cd8d1
--- /dev/null
+++ b/scripts/testing/maint-scenarios/23-pacnew-delete.sh
@@ -0,0 +1,22 @@
+# shellcheck shell=bash disable=SC2034 # sourced by run-maint-scenarios.sh
+# Scenario: a .pacnew file is deleted through the validated priv verb.
+#
+# pacdiff --output finds the planted file; the remedy takes the path as its
+# item and rm's it. A neighbouring non-pacnew file proves the verb's path
+# validation keeps the blast radius to the named file.
+SCENARIO_DESC="planted .pacnew removed by path"
+SCENARIO_GROUP="packages"
+SCENARIO_PROFILES="any"
+
+scenario_break() {
+ mexec "cp /etc/pacman.conf /etc/pacman.conf.pacnew && pacdiff --output | grep -q pacman.conf.pacnew"
+}
+
+scenario_fix() {
+ mfix pacnew_delete /etc/pacman.conf.pacnew
+}
+
+scenario_assert() {
+ mexec "test ! -e /etc/pacman.conf.pacnew && test -e /etc/pacman.conf" \
+ && massert_metric pkg_pacnew ok
+}