Skip to content

new pacdiff three way merging is confusing at first use

To start with I wanted to mention that the new three way merging of pacnew files is awesome, big improvement to trying to manually guess at why things are different in the pacnew file. That being said my first time using this new feature for me was a little confusing. Here is a quick walk through that experience for me:

[anitschk@RedWingBlackBird ~]$ sudo DIFFPROG="meld" pacdiff
==> pacnew file found for /etc/mkinitcpio.conf
:: (V)iew, (M)erge, (S)kip, (R)emove pacnew, (O)verwrite with pacnew, (Q)uit: [v/m/s/r/o/q] v

Hmm I have seen this (M)erge option for a while now, it is probably about time I give this a try.

Oh that gives me something like the following which has <<<<<<< / ||||||| / >>>>>>> three way merge markers.

##   NOTE: If you have /usr on a separate partition, you MUST include the
<<<<<<< /etc/mkinitcpio.conf
#    usr, fsck and shutdown hooks.
HOOKS=(base udev autodetect modconf block filesystems keyboard resume fsck)
||||||| /tmp/pacdiff-merge-mkinitcpio.conf.hWS/mkinitcpio.conf.base.nXV
#    usr, fsck and shutdown hooks.
HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)
=======
#    usr and fsck hooks.
HOOKS=(base udev autodetect modconf kms keyboard keymap consolefont block filesystems fsck)
>>>>>>> /etc/mkinitcpio.conf.pacnew

I know meld is able to handle 3 way merges, there should be a way to pass the files to meld in a way that it can handle this correctly. Oh look, on the man page there is an option for --threeway maybe that does what I want? From here I killed pacdiff and used sudo DIFFPROG="meld" pacdiff --threeway and then selected (M)erge to try to merge. That resulted in no change.

So lets look back at the man page. I see that there is something MERGEPROG that mentions diff3 as the "3-way merge program" to use. So maybe I need to do sudo DIFFPROG="meld" MMERGEPROG="meld" pacdiff --threeway? Yes, looks like that does the trick, now I am seeing a three way merge. Actually no, now that I exit from there I am seeing a second window asking me to merge my version of mkinitcpio.conf with an empty file? Ohh it is using the output of MERGEPROG to view on the right side of the merge pane.

At this point I resorted to looking at the source to figure out what is going on and finally figured out that the answer to get this working like I wanted was to do sudo DIFFPROG="meld" pacdiff --threeway followed by (V)iew instead of (M)erge

This whole process took a good bit of experimentation and the man page wasn't exactly clear about how I am supposed to correctly do this. I am not sure what the best solution is to make this easier for other users is as I still see value for some users to have the current (M)erge format of viewing files while others like me would prefer the --threeway with (V)iew. Perhaps just improve the man page? Or maybe don't show the (M)erge option if the user selected --threeway?

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information