One of the things that happens on a semi-regular basis on my machine is
that I update packages and a new version of /etc/services is available.
I have a couple of local service definitions in this file, so it's been
modified from the shipped version.
At this point I get the dpkg question about what to do -- overwrite with
the new file, keep the current one or show the differences.
It would be really nice to have an additional option, to use sdiff(1) to
merge the changes or, better, something that would function like
merge(1) and allowed editing if conflicts were detected.
Daniel
tag 120152 + patch thanks, Here's a patch that implements support for sdiff, or more generally "manual merge" (and actually fixes a few other bugs while doing so). Proposed changelog entries: * Added a 'Merge' option (Closes: #189805, #48717, #120152) * Enclosed file names with quotes in command string (Closes #147583) * Added a message with the path of the new conffile in Suspend * Ignore SIGINT while waiting for child processes so that dpkg doesn't die if the child is ctrl-c'd The patch adds a new 'M' option to the conflict prompt whenever environment variable 'MERGE2' is set or '/usr/bin/merge2' exists. To make merging a bit more comfortable, I've also written a fullscreen ncurses based drop-in replacement for sdiff (not in Main yet: http://elonen.iki.fi/code/imediff/). It registers itself as a 'merge2' alternative through 'update-alternatives', thus the '/usr/bin/merge2' check in the dpkg patch. I hope sdiff maintainer will agree with me to register sdiff also and I'm furthermore considering writing an sdiff compatibility wrapper around 'kompare'. - Jarno
Umm...
@@ -450,7 +450,7 @@
if (!p || !*p)
p=DEFAULTPAGER;
- sprintf(cmdbuf, DIFF " -Nu %.250s %.250s | %.250s", old, new, p);
+ sprintf(cmdbuf, DIFF " -N \"%.250s\" \"%.250s\" | %.250s", old, new, p);
s=getenv(SHELLENV);
if (!s || !*s)
It would help if you were more carefully reading your patch...
Ouch, sorry about that. What do you about 2-way merge otherwise, however? Would it be a better idea to skip it altogether, start storing the original conffiles and implement 3-way instead? Personally, I not sure anymore if it would really be worth it - you would still have to check each hunk manually because even a non-conflicting automatic merge can quite easily break the semantics of a configuration file. For example, adding a path field in the middle of a file could work fine with the defaults but might unintentionally override the values a user had specified earlier on the first line. - Jarno
That looks like a bad idea anyway; what if the filename contains ", $, or `? In general adding more levels of quotation is the wrong way to fix this kind of bug, as you can never win. Instead, forget about the quotes and simply backslash-escape non-word characters. The algorithm described in 'perldoc -f quotemeta' will do the job. Cheers,
Note, that this kind of execing of external programs will no longer be nescessary for the new dpkg. It doesn't use the shell to run things, so there are no quoting problems.
Ok, here's a new merge2 patch that replaces the previous one. It now escapes the file names as Colin noted. I've tested it with a conffile that contained both spaces and double quotes. - Jarno BTW: Is the new dpkg publicly available for a sneak peek yet, and where?
A note for those who would like to use merging already: I'm maintaining an unofficial branch of Dpkg that is otherwise identical to the main one except that it's has (update version of the) patch of bug #120152 applied: http://elonen.iki.fi/code/unofficial-debs/dpkg-merge/ Install package 'Imediff2' or do 'export MERGE2=/usr/bin/sdiff' to enable the functionality. - Jarno
In Arch? If so it'd be great if you could also publish your repository details. Thanks, Scott
I'm not sure what information you are asking exactly, but here's some: The binaries are (unfortunately) for i386 only and the apt lines for the repository are: deb http://elonen.iki.fi/code/unofficial-debs/ ./ deb-src http://elonen.iki.fi/code/unofficial-debs/ ./ List of all the packages in my repository (not just dpkg) is available at http://elonen.iki.fi/code/unofficial-debs/ The updated patch used for building the binary is always at http://elonen.iki.fi/code/unofficial-debs/dpkg-merge/dpkg-merge.patch and it's architecture independent. The build process is not automatic so the version may not always be in synch with 'main'. - Jarno
When you said you were maintaining an offical branch of dpkg, I assumed you had actually created a Branch of the Arch repository the code is in. There's one for the selinux-support, for example. Scott
which I build unofficial versions when a new Dpkg version is released. Nothing more. Sorry for being unclear. - Jarno
Here's the up-to-date patch I promised to attach. To test it, install Imediff2 (or install sdiff and export MERGE2=sdiff) and then update some package with modified conffile(s). If you don't have one handy and/or don't want to mess up any real packages' configs, you could try my dummy test package available at http://elonen.iki.fi/code/unofficial-debs/dpkg-merge/merge-test-package.tgz - Jarno
Hi, The yearly reminder: the patch is still valid. :) Could someone please take the time to check it out? The patch is not really that complex and the feature makes upgrading much easier if you have local changes to conffiles. http://elonen.iki.fi/code/unofficial-debs/dpkg-merge/dpkg-merge.1.13.10.patch - Jarno
Hi! Why isn't this patch being merged? I'm not saying it should, but considering it has about ten dups, at least getting an explanation about why it shouldn't be would be interesting. I have been searching the net for that explanation but I couldn't find any. Regards //Johan
Got this reply on the mailing list in case anybody else wants to know.---------- Forwarded message ---------- From: Raphael Hertzog Date: 2007-okt-23 18:32 Lack of review mainly. We have many patches lying in the BTS but many of them are old and probably don't apply anymore and need to be refreshed and discussed. Maybe this one is different, but then it's one out of many and until someone does the work to apply it, test it, it will continue lying here. The dpkg team is quite small compared to the task represented by the hundreds of bug reports. So the time of the main committers is limited and they can't review all bugs.
Raphael, since you say that Jarno's current patch applies fine to the current version of dpkg, would it be possible for you to merge it? While waiting for somebody to implement a three way merge, I'd much prefer a two way merge (Jarno's patch) to nothing (which is what we have now). Please merge the patch? Regards //Johan 2007/10/24, Raphael Hertzog <hertzog@debian.org>:
Hello, Good morning, We have gone through your samples from a partner and Here is our Order List. Please do bear in mind that we are very much in need of this order, quote your competitive prices. Kindly send the Order confirmation. Your early reply will be much appreciated. Best Regards, Maryanah Erwin. PT FINDORA INTERNUSA Jln Pahlawan 66 Kec. Arjawinangun 45162 CIREBON West-Java INDONESIA tel : +62 231 357334 fax: +62 231 357260 email: marketing@findora.com