summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch')
-rw-r--r--meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch66
1 files changed, 40 insertions, 26 deletions
diff --git a/meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch b/meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch
index 80504ce8b9..bd4d5d5353 100644
--- a/meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch
+++ b/meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch
@@ -1,7 +1,7 @@
-From 24229971492515b64c81e8c6392e5dfbdc22b44c Mon Sep 17 00:00:00 2001
+From ff325b35639a797edd92b373fbebf7b8b9f3f0c3 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Wed, 26 Aug 2015 16:25:45 +0300
-Subject: [PATCH 3/5] Our pre/postinsts expect $D to be set when running in a
+Subject: [PATCH] Our pre/postinsts expect $D to be set when running in a
sysroot and don't expect a chroot. This matches up our system expectations
with what dpkg does.
@@ -9,36 +9,48 @@ Upstream-Status: Inappropriate [OE Specific]
RP 2011/12/07
ALIMON 2016/05/26
+ALIMON 2017/02/21
+KKang 2019/02/20
---
- src/script.c | 39 +++------------------------------------
- 1 file changed, 3 insertions(+), 36 deletions(-)
+ src/main/script.c | 53 +++--------------------------------------------
+ 1 file changed, 3 insertions(+), 50 deletions(-)
-diff --git a/src/script.c b/src/script.c
-index 3c88be8..ce66a86 100644
---- a/src/script.c
-+++ b/src/script.c
-@@ -97,43 +97,10 @@ setexecute(const char *path, struct stat *stab)
- static const char *
+diff --git a/src/main/script.c b/src/main/script.c
+index ecce4d842..16f4e6ff5 100644
+--- a/src/main/script.c
++++ b/src/main/script.c
+@@ -97,58 +97,11 @@ static const char *
maintscript_pre_exec(struct command *cmd)
{
+ const char *instdir = dpkg_fsys_get_dir();
- const char *admindir = dpkg_db_get_dir();
-- const char *changedir = fc_script_chrootless ? instdir : "/";
-- size_t instdirl = strlen(instdir);
+- const char *changedir;
+- size_t instdirlen = strlen(instdir);
+
+- if (instdirlen > 0 && in_force(FORCE_SCRIPT_CHROOTLESS))
+- changedir = instdir;
+- else
+- changedir = "/";
+-
+- if (instdirlen > 0 && !in_force(FORCE_SCRIPT_CHROOTLESS)) {
+- int rc;
-
-- if (*instdir && !fc_script_chrootless) {
-- if (strncmp(admindir, instdir, instdirl) != 0)
+- if (strncmp(admindir, instdir, instdirlen) != 0)
- ohshit(_("admindir must be inside instdir for dpkg to work properly"));
-- if (setenv("DPKG_ADMINDIR", admindir + instdirl, 1) < 0)
+- if (setenv("DPKG_ADMINDIR", admindir + instdirlen, 1) < 0)
- ohshite(_("unable to setenv for subprocesses"));
- if (setenv("DPKG_ROOT", "", 1) < 0)
- ohshite(_("unable to setenv for subprocesses"));
-
-- if (chroot(instdir))
+- rc = chroot(instdir);
+- if (rc && in_force(FORCE_NON_ROOT) && errno == EPERM)
+- ohshit(_("not enough privileges to change root "
+- "directory with --force-not-root, consider "
+- "using --force-script-chrootless?"));
+- else if (rc)
- ohshite(_("failed to chroot to '%.250s'"), instdir);
-+ if (*instdir) {
-+ setenv("D", instdir, 1);
- }
+- }
- /* Switch to a known good directory to give the maintainer script
- * a saner environment, also needed after the chroot(). */
- if (chdir(changedir))
@@ -55,16 +67,18 @@ index 3c88be8..ce66a86 100644
- debug(dbg_scripts, "fork/exec %s (%s )", cmd->filename,
- args.buf);
- varbuf_destroy(&args);
-- }
-- if (!instdirl || fc_script_chrootless)
++ if (*instdir) {
++ setenv("D", instdir, 1);
+ }
+- if (instdirlen == 0 || in_force(FORCE_SCRIPT_CHROOTLESS))
- return cmd->filename;
-
-- assert(strlen(cmd->filename) >= instdirl);
-- return cmd->filename + instdirl;
+- if (strlen(cmd->filename) < instdirlen)
+- internerr("maintscript name '%s' length < instdir length %zd",
+- cmd->filename, instdirlen);
+-
+- return cmd->filename + instdirlen;
+ return cmd->filename;
}
/**
---
-2.1.4
-