Bug 287748

Summary: Kompare doesn't install any diff utility and doesn't work
Product: [Unmaintained] kde-windows Reporter: Aqeel Zafar <aqeel>
Component: portingAssignee: KDE-Windows <kde-windows>
Status: RESOLVED FIXED    
Severity: normal CC: andriusmao, kevin.kofler, ps_ml, seajey.serg
Priority: NOR    
Version: 4.7   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Aqeel Zafar 2011-11-28 13:49:55 UTC
Version:           4.7.0 (using KDE 4.7.0) 
OS:                MS Windows

I installed Kompare, but it doesn't compare any files. In 'Compare files' dialog, there is an option to enter path for diff utility, which is empty, and I couldn't find any on my system or in KDE installer, so I am assuming KDE just didn't install any and that is why Kompare can't compare any files.

Reproducible: Always

Steps to Reproduce:
1. Run Kompare
2. Select two files to compare.

Actual Results:  
Nothing happens

Expected Results:  
Kompare should show differences between both files.
Comment 1 Patrick Spendrin 2011-11-28 14:27:40 UTC
can you download & unpack diffutils from http://gnuwin32.sourceforge.net/packages/diffutils.htm and try if it works using this package? If it works using that package, we can add that as a 3rdparty dependency.
Comment 2 Sergei Andreev 2011-11-28 16:44:28 UTC
I've checked with diff.exe and cmp.exe - it does not work. Error message is "Could not parse diff output."
Comment 3 Patrick Spendrin 2011-11-28 19:40:11 UTC
hm, I tried to reproduce your results, but it seems to work for me (after I installed the gnuwin32 diff.exe). It did not work with cmp.exe nor with diff3.exe (it gave your error message).
Some other things that might be different: I have build the 4.7 branch of kompare, similar to what will be released as 4.7.4 in a couple of days. If you have a setup available, maybe you can make sure that this is the issue, otherwise you can wait for our binaries (we will make a 4.7.4 release). I will adapt the dependencies accordingly so diffutils will be installed with kompare.
Comment 4 Sergei Andreev 2011-11-28 19:43:37 UTC
I've tested with KDE 4.5.4
KDE SC 4.7.0 is unusable on my setup due to Bug 285854
Comment 5 Aqeel Zafar 2011-11-30 07:32:07 UTC
It is working with diff.exe from gnuWin32's diffutils package.

Just a point, it wasn't working when I just downloaded diff binaries, but it worked after I installed the setup and used those binaries.
Comment 6 Patrick Spendrin 2011-11-30 13:51:05 UTC
Git commit c21ed20722ee73d31f2f8ec826bba9e8bf153ad2 by Patrick Spendrin.
Committed on 30/11/2011 at 14:39.
Pushed by sengels into branch 'kde-4.7.3'.

add dependency to diffutils for kompare package
BUG:287748

M  +1    -0    portage/kde/kdesdk/kdesdk-package.xml

http://commits.kde.org/emerge/c21ed20722ee73d31f2f8ec826bba9e8bf153ad2
Comment 7 Kevin Kofler 2011-12-02 04:16:17 UTC
> It did not work with cmp.exe nor with diff3.exe (it gave your error message).

That is expected, diff.exe is what is needed.

Pretty much any version of diff.exe should work as long as it's either GNU diff or something compatible with it. Using the GNU diffutils will definitely work because that's what we use on Fedora GNU/Linux and thus what I test with.

> add dependency to diffutils for kompare package

Thanks, that should make Kompare easier to install for users of that inferior operating system. ;-)

-- Kevin Kofler, maintainer of Kompare
Comment 8 Kevin Kofler 2011-12-02 04:19:50 UTC
Oh, by the way, does the code automatically find the diff.exe once it is installed or do you have to set it manually? On GNU/Linux, if you leave the field empty in the settings (which is the default), it will find diff automatically, does that also work for you? If not, we should fix it.
Comment 9 Aqeel Zafar 2011-12-02 08:09:21 UTC
(In reply to comment #8)
> Oh, by the way, does the code automatically find the diff.exe once it is
> installed or do you have to set it manually? On GNU/Linux, if you leave the
> field empty in the settings (which is the default), it will find diff
> automatically, does that also work for you? If not, we should fix it.

No it doesn't work unless you put the full path in. On Linux, diff is in system path, which is not the case in Windows, so I am not sure how you can do it, but then again I don't know much about windows development.
Comment 10 Kevin Kofler 2011-12-02 08:46:12 UTC
The problem is that KompareProcess::writeDefaultCommandLine and KompareProcess::writeCommandLine default to just "diff", which indeed will only work if the executable is in your PATH. This should probably use KStandardDirs::findExe.
Comment 11 Patrick Spendrin 2011-12-03 20:33:18 UTC
KStandardDirs sounds good, although if the working directory of KProcess is the one in which the kompare executable exists, then just calling diff should also work (given that you have installed diffutils into that location too). I am just not sure how diff is called from kompare.
Comment 13 Andrius 2011-12-03 23:48:54 UTC
Maybe just a reverie, but would a "fc" (native comparison utility) backend be feasible?
Comment 14 Kevin Kofler 2011-12-03 23:52:36 UTC
If you write the code, maybe… ;-) But there's quite a lot of code which relies on diff options, parsing diff-formatted patches etc., and I'm not sure "fc" is anywhere near powerful enough to support Kompare's functionality.

I think depending on gnuwin32 diffutils is the best solution, we just need to make sure the diff.exe is found automatically.