Bug 238297 - Infinite loop in "Save diff" when compared files are on different drive letters
Summary: Infinite loop in "Save diff" when compared files are on different drive letters
Status: RESOLVED FIXED
Alias: None
Product: kompare
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Microsoft Windows
: NOR normal (vote)
Target Milestone: ---
Assignee: KDE-Windows
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-20 14:52 UTC by Krzysztof Nowicki
Modified: 2013-05-11 00:36 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.10.4


Attachments
Proposed patch (705 bytes, patch)
2010-05-20 14:59 UTC, Krzysztof Nowicki
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Krzysztof Nowicki 2010-05-20 14:52:33 UTC
Version:            (using KDE 4.4.3)
Compiler:          MSVC 9.0 
OS:                MS Windows
Installed from:    Compiled From Sources

On MS Windows, when comparing two files that are residing on different drive letters, Kompare falls into an infinite loop after selecting the "Save diff" option.

The reason for this problem is that Kompare tries to find a common root path for both files. On Unix there is always one common root for all files, while on MS Windows this is not the case. Kompare will try to walk up the path, but once it hits the root directory of a drive, it won't detect, that it can't go any further and will keep trying.
Comment 1 Krzysztof Nowicki 2010-05-20 14:59:44 UTC
Created attachment 43745 [details]
Proposed patch

The patch fixes the problem, although it's not necessarily a clean solution. An ideal fix would involve adding something like KUrl::isTopLevel() and making use of it here.
Comment 2 Kevin Kofler 2010-05-20 19:03:49 UTC
Your diff is reversed, but otherwise looks OK.
Comment 3 Krzysztof Nowicki 2010-05-20 19:29:15 UTC
It was created with the patched Kompare itself :)

I've found a similar bug in KDirSelectDialog::Private::slotComboTextChanged(), but there is more mess in there and it's a subject for another PR.
Comment 4 Kevin Kofler 2010-05-20 19:50:34 UTC
> It was created with the patched Kompare itself :)

Try File / Swap source and destination. :-)

But I guess that's for next time, we can work with the reversed patch just fine (that's what patch has a -R option for).
Comment 5 Patrick Spendrin 2013-05-02 19:54:39 UTC
Git commit fd2d6e32dfa724f0b2fcffe4766d2d7faf84d437 by Patrick Spendrin.
Committed on 02/05/2013 at 13:34.
Pushed by sengels into branch 'kde-4.10'.

fix endless loop

patch taken from bugreport and will be committed asap.

M  +1    -0    portage/kde/kdesdk/kompare/kompare-20130225.py
A  +19   -0    portage/kde/kdesdk/kompare/kompare-4.10.2-20130502.diff

http://commits.kde.org/emerge/fd2d6e32dfa724f0b2fcffe4766d2d7faf84d437
Comment 6 Patrick Spendrin 2013-05-10 20:54:52 UTC
Git commit d05571620258b9714cbc338c5af6f4419cf601c3 by Patrick Spendrin.
Committed on 10/05/2013 at 22:53.
Pushed by sengels into branch 'KDE/4.10'.

fix endless loop

do not go into infinite loop in "save diff"

M  +2    -2    komparepart/komparesaveoptionswidget.cpp

http://commits.kde.org/kompare/d05571620258b9714cbc338c5af6f4419cf601c3
Comment 7 Patrick Spendrin 2013-05-10 20:58:56 UTC
Git commit 7ca56c747dbb135ad1f632fde3ceaba54cfff3b5 by Patrick Spendrin.
Committed on 10/05/2013 at 22:53.
Pushed by sengels into branch 'master'.

fix endless loop

do not go into infinite loop in "save diff"

M  +2    -2    komparepart/komparesaveoptionswidget.cpp

http://commits.kde.org/kompare/7ca56c747dbb135ad1f632fde3ceaba54cfff3b5