#120152 [CONFFILE] dpkg: Merge changes to conffiles in with sdiff(1)

Package:
dpkg
Source:
dpkg
Description:
Debian package management system
Submitter:
Daniel Pittman
Date:
2021-09-22 04:39:03 UTC
Severity:
wishlist
Tags:
#120152#5
Date:
2001-11-19 00:53:52 UTC
From:
To:
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

#120152#16
Date:
2003-11-15 17:05:04 UTC
From:
To:
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

#120152#23
Date:
2003-11-15 19:52:52 UTC
From:
To:
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...

#120152#28
Date:
2003-11-15 23:17:37 UTC
From:
To:
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

#120152#33
Date:
2003-11-17 15:32:32 UTC
From:
To:
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,

#120152#38
Date:
2003-11-17 16:57:23 UTC
From:
To:
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.

#120152#43
Date:
2003-11-17 22:28:52 UTC
From:
To:
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?

#120152#56
Date:
2004-11-20 16:15:42 UTC
From:
To:
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

#120152#61
Date:
2004-11-20 16:35:27 UTC
From:
To:
In Arch?  If so it'd be great if you could also publish your repository
details.

Thanks,

Scott

#120152#66
Date:
2004-11-20 16:55:34 UTC
From:
To:
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

#120152#71
Date:
2004-11-20 17:06:50 UTC
From:
To:
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

#120152#76
Date:
2004-11-20 17:18:03 UTC
From:
To:
which I build unofficial versions when a new Dpkg version is released.
Nothing more. Sorry for being unclear.

- Jarno

#120152#87
Date:
2005-07-15 16:12:05 UTC
From:
To:
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

#120152#92
Date:
2006-04-03 09:37:21 UTC
From:
To:
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

#120152#105
Date:
2007-10-23 14:52:23 UTC
From:
To:
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

#120152#110
Date:
2007-10-24 11:39:28 UTC
From:
To:
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.
#120152#115
Date:
2007-11-23 16:21:46 UTC
From:
To:
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>:

#120152#130
Date:
2021-09-22 04:26:56 UTC
From:
To:
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