The following commit has been merged in the master branch:
commit 6f037003e8b96878b485efb7cbd1f846e3bf4e97
Author: Guillem Jover <[email protected]>
Date:   Sat Feb 20 06:29:48 2010 +0100

    dpkg: Always spawn a new shell on conffile prompt
    
    Stop supporting self backgrounding, remove DPKG_NO_TSTP environment
    variable support, as we always spawn a shell now.
    
    This will allow setting useful environment variables for the user to use
    with other tools. And is less confusing, as the action to go back to
    dpkg does not depend on how dpkg was run.
    
    Closes: #38334

diff --git a/TODO b/TODO
index 814593e..86ba627 100644
--- a/TODO
+++ b/TODO
@@ -91,8 +91,6 @@ TODO
    automatically.
    - Support for output format. (#214566)
 
- * Remove conffile background support? (#38334)
-
  * Propagate --admindir to programs run from maintainer scritpts. (#97076)
 
  * Fix conflicting action -%c, when short is 0.
diff --git a/debian/changelog b/debian/changelog
index b6861ba..a79b962 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -95,6 +95,9 @@ dpkg (1.15.6) UNRELEASED; urgency=low
   * Change dpkg-dev to Depend on perl instead of perl5 and perl-modules.
   * Fix small memory leaks related to scandir() in dpkg-deb and libdpkg.
   * Fix dpkg-query and dpkg-trigger to actually print a version on --version.
+  * Always spawn a new shell on conffile prompt, instead of supporting
+    self backgrounding, remove DPKG_NO_TSTP environment variable support.
+    Closes: #38334
 
   [ Modestas Vainius ]
   * Implement symbol patterns (Closes: #563752). From now on, it is possible to
diff --git a/doc/README.feature-removal-schedule 
b/doc/README.feature-removal-schedule
index afd5735..57d5626 100644
--- a/doc/README.feature-removal-schedule
+++ b/doc/README.feature-removal-schedule
@@ -98,4 +98,11 @@ Why:
  Custom changelog parsers must be updated to support the new API (see
  dpkg-parsechangelog(1) and README.api).
 
+What: support for environment variable DPKG_NO_TSTP
+Status: removed
+Since: 1.15.6
+Why:
+ Having two ways to let the administrator get to a shell on conffile prompt
+ is confusing, it also difficults setting up a consistent environment to be
+ used by external programs.
 
diff --git a/lib/dpkg/dpkg.h b/lib/dpkg/dpkg.h
index 584e1ab..e8c54ba 100644
--- a/lib/dpkg/dpkg.h
+++ b/lib/dpkg/dpkg.h
@@ -87,7 +87,6 @@ DPKG_BEGIN_DECLS
 #define MAINTSCRIPTARCHENVVAR "DPKG_MAINTSCRIPT_ARCH"
 #define MAINTSCRIPTDPKGENVVAR "DPKG_RUNNING_VERSION"
 
-#define NOJOBCTRLSTOPENV    "DPKG_NO_TSTP"
 #define SHELLENV            "SHELL"
 #define DEFAULTSHELL        "sh"
 #define PAGERENV            "PAGER"
diff --git a/man/dpkg.1 b/man/dpkg.1
index 69a60f8..74a8c4b 100644
--- a/man/dpkg.1
+++ b/man/dpkg.1
@@ -1,4 +1,4 @@
-.TH dpkg 1 "2009-11-12" "Debian Project" "dpkg suite"
+.TH dpkg 1 "2010-02-20" "Debian Project" "dpkg suite"
 .SH NAME
 dpkg \- package manager for Debian
 .
@@ -613,10 +613,6 @@ for more information about them:
 .
 .SH ENVIRONMENT VARIABLES
 .TP
-.B DPKG_NO_TSTP
-Define this to something if you prefer \fBdpkg\fP starting a new
-shell rather than suspending itself, while doing a shell escape.
-.TP
 .B SHELL
 The program \fBdpkg\fP will execute when starting a new shell.
 .TP
diff --git a/src/configure.c b/src/configure.c
index aa974cc..42245f0 100644
--- a/src/configure.c
+++ b/src/configure.c
@@ -57,7 +57,6 @@ static int conffoptcells[2][2] = {
 
 static void md5hash(struct pkginfo *pkg, char *hashbuf, const char *fn);
 static void showdiff(const char *old, const char *new);
-static void suspend(void);
 static enum conffopt promptconfaction(struct pkginfo *pkg, const char *cfgfile,
                                       const char *realold, const char *realnew,
                                       int useredited, int distedited,
@@ -516,44 +515,33 @@ showdiff(const char *old, const char *new)
 }
 
 /**
- * Suspend dpkg temporarily.
+ * Spawn a new shell.
  *
- * Either create a subprocess and execute a shell or background the current
- * process to allow the user to manually solve the conffile conflict.
+ * Create a subprocess and execute a shell to allow the user to manually
+ * solve the conffile conflict.
  */
 static void
-suspend(void)
+spawn_shell(void)
 {
-       const char *env;
        pid_t pid;
 
-       env = getenv(NOJOBCTRLSTOPENV);
-       if (env && *env) {
-               /* Do not job control to suspend but fork and start a new
-                * shell instead. */
+       fputs(_("Type `exit' when you're done.\n"), stderr);
 
-               fputs(_("Type `exit' when you're done.\n"), stderr);
-
-               pid = subproc_fork();
-               if (!pid) {
-                       /* Child process */
-                       const char *shell;
-
-                       shell = getenv(SHELLENV);
-                       if (!shell || !*shell)
-                               shell = DEFAULTSHELL;
+       pid = subproc_fork();
+       if (!pid) {
+               /* Child process */
+               const char *shell;
 
-                       execlp(shell, shell, "-i", NULL);
-                       ohshite(_("failed to exec shell (%.250s)"), shell);
-               }
+               shell = getenv(SHELLENV);
+               if (!shell || !*shell)
+                       shell = DEFAULTSHELL;
 
-               /* Parent process. */
-               subproc_wait(pid, "shell");
-       } else {
-               fputs(_("Don't forget to foreground (`fg') this "
-                       "process when you're done !\n"), stderr);
-               kill(-getpgid(0), SIGTSTP);
+               execlp(shell, shell, "-i", NULL);
+               ohshite(_("failed to exec shell (%.250s)"), shell);
        }
+
+       /* Parent process. */
+       subproc_wait(pid, "shell");
 }
 
 /**
@@ -653,7 +641,7 @@ promptconfaction(struct pkginfo *pkg, const char *cfgfile,
                          "    Y or I  : install the package maintainer's 
version\n"
                          "    N or O  : keep your currently-installed 
version\n"
                          "      D     : show the differences between the 
versions\n"
-                         "      Z     : background this process to examine the 
situation\n"));
+                         "      Z     : start a shell to examine the 
situation\n"));
 
                if (what & cfof_keep)
                        fprintf(stderr, _(" The default action is to keep your 
current version.\n"));
@@ -698,7 +686,7 @@ promptconfaction(struct pkginfo *pkg, const char *cfgfile,
                        showdiff(realold, realnew);
 
                if (cc == 'z')
-                       suspend();
+                       spawn_shell();
        } while (!strchr("yino", cc));
 
        log_message("conffile %s %s", cfgfile,

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to