Bug 469923

Summary: Kdiff3 crashes when the compared directories contain symlinks with nonexistent targets
Product: [Applications] kdiff3 Reporter: Jiri Palecek <jpalecek>
Component: applicationAssignee: michael <reeves.87>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version First Reported In: 1.10.0   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 1.10.5
Sentry Crash Report:

Description Jiri Palecek 2023-05-18 01:20:56 UTC
Application: kdiff3 (1.9.70 (64 bit))

Qt Version: 5.15.8
Frameworks Version: 5.103.0
Operating System: Linux 6.1.0-6-amd64 x86_64
Windowing System: X11
Distribution: Debian GNU/Linux 12 (bookworm)
DrKonqi: 5.27.2 [KCrashBackend]

-- Information about the crash:
Hello

when I tried to compare two directories, kdiff 3 crashed. From the bactrace and inspection under gdb, I can see this is because it tripped on a file which is a symlink with nonexistant target. QFileInfo can't provide a modification time in that case, therefore the modification time is invalid, which causes an assert failure.

The crash can be reproduced every time.

-- Backtrace:
Application: KDiff3 (kdiff3), signal: Aborted

[KCrash Handler]
#4  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#5  0x00007ff257ea9d2f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#6  0x00007ff257e5aef2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#7  0x00007ff257e45472 in __GI_abort () at ./stdlib/abort.c:79
#8  0x00007ff257e45395 in __assert_fail_base (fmt=0x7ff2515db91f "%s%s%s:%u: %s%sP\305\231edpoklad \342\200\236%s\342\200\234 nespln\304\233n.\n%n", assertion=assertion@entry=0x55f87554a7a8 "!m_modificationTime.isNull()", file=file@entry=0x55f87554a728 "./src/fileaccess.cpp", line=line@entry=762, function=function@entry=0x55f87554aa38 "QDateTime FileAccess::lastModified() const") at ./assert/assert.c:92
#9  0x00007ff257e53df2 in __GI___assert_fail (assertion=0x55f87554a7a8 "!m_modificationTime.isNull()", file=0x55f87554a728 "./src/fileaccess.cpp", line=762, function=0x55f87554aa38 "QDateTime FileAccess::lastModified() const") at ./assert/assert.c:101
#10 0x000055f8754d41c0 in FileAccess::lastModified (this=<optimized out>) at ./src/fileaccess.cpp:762
#11 0x000055f875510182 in MergeFileInfos::compareFilesAndCalcAges (this=this@entry=0x55f87cff1aa0, errors=..., pOptions=..., pDMW=0x55f87757aaa0) at ./src/MergeFileInfos.cpp:192
#12 0x000055f87546e4d0 in DirectoryMergeWindow::DirectoryMergeWindowPrivate::prepareListView (this=this@entry=0x55f8775bcc80, pp=...) at ./src/directorymergewindow.cpp:1331
#13 0x000055f875471fbb in DirectoryMergeWindow::DirectoryMergeWindowPrivate::init (this=0x55f8775bcc80, bDirectoryMerge=<optimized out>, bReload=<optimized out>) at ./src/directorymergewindow.cpp:951
#14 0x000055f875472ee0 in DirectoryMergeWindow::init (this=<optimized out>, bDirectoryMerge=<optimized out>, bReload=<optimized out>) at ./src/directorymergewindow.cpp:736
#15 0x000055f875488d59 in KDiff3App::doDirectoryCompare (this=this@entry=0x55f8772d05e0, bCreateNewInstance=bCreateNewInstance@entry=false) at ./src/pdiff.cpp:1627
#16 0x000055f87545da3f in KDiff3App::completeInit (this=0x55f8772d05e0, fn1=..., fn2=..., fn3=...) at ./src/kdiff3.cpp:432
#17 0x000055f87544fda8 in KDiff3Shell::KDiff3Shell (this=0x55f876f6a410, bCompleteInit=<optimized out>, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at ./src/kdiff3_shell.cpp:60
#18 0x000055f8754447bb in main (argc=<optimized out>, argv=<optimized out>) at ./src/main.cpp:197
[Inferior 1 (process 78517) detached]
Comment 1 michael 2023-05-19 17:28:07 UTC
Git commit 3d27dfd6c3c61e24fadec8797f2ca862fc37e1f7 by Michael Reeves.
Committed on 19/05/2023 at 15:50.
Pushed by mreeves into branch 'master'.

Remove assert failing on missing files
Related: bug 469269
FIX-IN:FIXED-IN:1.10.5

M  +0    -1    src/fileaccess.cpp

https://invent.kde.org/sdk/kdiff3/commit/3d27dfd6c3c61e24fadec8797f2ca862fc37e1f7
Comment 2 michael 2023-05-19 17:28:45 UTC
Git commit 9a5de7262c9cb010e2b4ef3abd3fec869c839f15 by Michael Reeves.
Committed on 19/05/2023 at 15:49.
Pushed by mreeves into branch '1.10'.

Remove assert failing on missing files
Related: bug 469269
FIX-IN:FIXED-IN:1.10.5

M  +0    -1    src/fileaccess.cpp

https://invent.kde.org/sdk/kdiff3/commit/9a5de7262c9cb010e2b4ef3abd3fec869c839f15