The following commit has been merged in the master branch:
commit 7fb7f6e1542f57590fdb8bb544380cf5d923bb62
Author: Guillem Jover <[email protected]>
Date: Wed Sep 5 19:37:27 2012 +0200
pkg: Change directory to / before executing maintainer scripts
This should give maintainer scripts a more stable and sane environment.
This change does not work too well with relative admindir paths, as they
need to be normalized on input. But then several dpkg tools do not play
nice with relative amindirs anyway, and this needs a general cleanup
which will be done on subsequent commits.
Closes: #686782
diff --git a/debian/changelog b/debian/changelog
index cc86220..0165116 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -68,6 +68,7 @@ dpkg (1.17.0) UNRELEASED; urgency=low
when we are definitely removing the main path.
* Activate file triggers on removal more accurately, only when we know
we are inevitably removing things.
+ * Change dir to / before executing maintainer scripts. Closes: #686782
-- Guillem Jover <[email protected]> Fri, 03 Aug 2012 13:21:00 +0200
diff --git a/src/script.c b/src/script.c
index d8ba6a3..97dc15b 100644
--- a/src/script.c
+++ b/src/script.c
@@ -118,9 +118,11 @@ preexecscript(struct command *cmd)
if (chroot(instdir))
ohshite(_("failed to chroot to `%.250s'"), instdir);
- if (chdir("/"))
- ohshite(_("failed to chdir to `%.255s'"), "/");
}
+ /* Switch to a known good directory to give the maintainer script
+ * a saner environment, also needed after the chroot(). */
+ if (chdir("/"))
+ ohshite(_("failed to chdir to `%.255s'"), "/");
if (debug_has_flag(dbg_scripts)) {
struct varbuf args = VARBUF_INIT;
const char **argv = cmd->argv;
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]