Sfoglia il codice sorgente

dpkg: On --force-chrootless only set changedir to instdir if defined

This breaks --force-chrootless (or --force-all, which is a terrible
idea in general) without having set --instdir.

Closes: #824542
Signed-off-by: Guillem Jover <guillem@debian.org>
Niall Walsh 10 anni fa
parent
commit
b287415902
2 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  1. 2 0
      debian/changelog
  2. 1 1
      src/script.c

+ 2 - 0
debian/changelog

@@ -18,6 +18,8 @@ dpkg (1.18.8) UNRELEASED; urgency=medium
   * Set return buffer length for sysctl(2) calls on */kFreeBSD in
     start-stop-daemon.
   * Abstract ar archive handling behind a new struct dpkg_ar and functions.
+  * On dpkg --force-chrootless only set changedir to instdir if defined.
+    Thanks to Niall Walsh <niallwalsh@celtux.org>. Closes: #824542
   * Perl modules:
     - Use warnings::warnif() instead of carp() for deprecated warnings.
     - Add new format_range() method and deprecate dpkg() and rfc822() methods

+ 1 - 1
src/script.c

@@ -98,7 +98,7 @@ static const char *
 maintscript_pre_exec(struct command *cmd)
 {
 	const char *admindir = dpkg_db_get_dir();
-	const char *changedir = fc_script_chrootless ? instdir : "/";
+	const char *changedir = (*instdir && fc_script_chrootless) ? instdir : "/";
 	size_t instdirl = strlen(instdir);
 
 	if (*instdir && !fc_script_chrootless) {