On Wed, 31 Aug 2011 14:08:34 +0100 Paul LeoNerd Evans <leon...@leonerd.org.uk> wrote:
> Any particular reason the above patch, or functionallity like it, > hasn't been added into dpkg yet? I find that the vast majority of > cases when dpkg finds a difference in a file, I hit Z to get a shell, > then In order for this bug not to sit idle for yet another five years, attached is my attempt at a patch. I haven't been able to properly test it in all variations and configurations, but hopefully it at least serves as a useful hint into someone managing to get somewhere into fixing it. I'm also offering a USD100 bounty to anyone who can get this properly fixed and applied into Debian mainline. https://twitter.com/cpan_pevans/status/984101376480481286 -- Paul "LeoNerd" Evans leon...@leonerd.org.uk | https://metacpan.org/author/PEVANS http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
diff -ur dpkg-1.18.22/src/configure.c dpkg-1.18.22+EDIT/src/configure.c --- dpkg-1.18.22/src/configure.c 2017-01-31 03:03:31.000000000 +0000 +++ dpkg-1.18.22+EDIT/src/configure.c 2017-03-05 14:34:32.605187891 +0000 @@ -150,6 +150,7 @@ " 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" + " E : open both files in vimdiff\n" " Z : start a shell to examine the situation\n")); if (what & CFOF_KEEP) @@ -160,7 +161,7 @@ _(" The default action is to install the new version.\n")); s = path_basename(cfgfile); - fprintf(stderr, "*** %s (Y/I/N/O/D/Z) %s ? ", s, + fprintf(stderr, "*** %s (Y/I/N/O/D/E/Z) %s ? ", s, (what & CFOF_KEEP) ? _("[default=N]") : (what & CFOF_INSTALL) ? _("[default=Y]") : _("[no default]")); @@ -217,6 +218,32 @@ } /** + * Open the diff editor between two files. + * + * @param old The path to the old file. + * @param new The path to the new file. + */ +static void +show_editor(const char *old, const char *new) +{ + pid_t pid; + + pid = subproc_fork(); + if (!pid) { + /* Child process. */ + char cmdbuf[1024]; + + sprintf(cmdbuf, "vimdiff %.250s %.250s", + str_quote_meta(old), str_quote_meta(new)); + + command_shell(cmdbuf, _("conffile difference editor")); + } + + /* Parent process. */ + subproc_reap(pid, _("conffile difference editor"), SUBPROC_NOCHECK); +} + +/** * Spawn a new shell. * * Create a subprocess and execute a shell to allow the user to manually @@ -292,6 +319,9 @@ if (cc == 'd') show_diff(realold, realnew); + if (cc == 'e') + show_editor(realold, realnew); + if (cc == 'z') spawn_shell(realold, realnew); } while (!strchr("yino", cc));
pgpXJztRRGJmD.pgp
Description: OpenPGP digital signature