summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog2
-rw-r--r--src/select.c17
2 files changed, 17 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index 4c7b0d55d..438944b95 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,8 @@ dpkg (1.17.17) UNRELEASED; urgency=low
* Mark for translation and improve dselect method handling error messages.
* Defer trigger processing if the package does not fulfill dependencies.
Closes: #671711
+ * Do not write to the database when changing selections with --dry-run.
+ Closes: #764673
[ Updated programs translations ]
* German (Sven Joachim).
diff --git a/src/select.c b/src/select.c
index 41e82da19..cdfd5bdd4 100644
--- a/src/select.c
+++ b/src/select.c
@@ -109,6 +109,7 @@ getselections(const char *const *argv)
int
setselections(const char *const *argv)
{
+ enum modstatdb_rw msdbflags;
const struct namevalue *nv;
struct pkginfo *pkg;
int c, lno;
@@ -119,7 +120,13 @@ setselections(const char *const *argv)
if (*argv)
badusage(_("--%s takes no arguments"), cipaction->olong);
- modstatdb_open(msdbrw_write | msdbrw_available_readonly);
+ msdbflags = msdbrw_available_readonly;
+ if (f_noact)
+ msdbflags |= msdbrw_readonly;
+ else
+ msdbflags |= msdbrw_write;
+
+ modstatdb_open(msdbflags);
pkg_infodb_upgrade();
lno= 1;
@@ -194,13 +201,19 @@ setselections(const char *const *argv)
int
clearselections(const char *const *argv)
{
+ enum modstatdb_rw msdbflags;
struct pkgiterator *it;
struct pkginfo *pkg;
if (*argv)
badusage(_("--%s takes no arguments"), cipaction->olong);
- modstatdb_open(msdbrw_write);
+ if (f_noact)
+ msdbflags = msdbrw_readonly;
+ else
+ msdbflags = msdbrw_write;
+
+ modstatdb_open(msdbflags);
pkg_infodb_upgrade();
it = pkg_db_iter_new();