为 dpkg 的配置文件提示指定 diff 选项

为 dpkg 的配置文件提示指定 diff 选项

当配置文件被修改时,dpkg会提示您做什么:

Configuration file '/etc/apache2/mods-available/ssl.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** ssl.conf (Y/I/N/O/D/Z) [default=N] ? 

当您选择 时D,它将diff -Nu在当前的新配置文件上运行。

如何指定不同的diff选项?特别是,我经常想指定-b. (显然,您可以手动重新运行 diff,但这远不太方便。)

答案1

看来你不能; diff 选项被硬编码在dpkg的源代码中。从src/configure.c:

            /* Child process. */
            char cmdbuf[1024];

            sprintf(cmdbuf, DIFF " -Nu %.250s %.250s | %.250s",
                    str_quote_meta(old), str_quote_meta(new),
                    command_get_pager());

            command_shell(cmdbuf, _("conffile difference visualizer"));

DIFF是一个宏lib/dpkg/dpkg.h并且刚刚定义为"diff".所以这是diff -Nu硬编码的。

这大概是Debian 错误 #380332

相关内容