Bug 466241 - kdiff3 crashes on invalid symbolic link
Summary: kdiff3 crashes on invalid symbolic link
Status: RESOLVED FIXED
Alias: None
Product: kdiff3
Classification: Applications
Component: application (other bugs)
Version First Reported In: 1.10.0
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: michael
URL:
Keywords:
: 467086 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-02-22 13:49 UTC by P. Adam Sowa
Modified: 2023-07-04 23:49 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 1.10.1
Sentry Crash Report:


Attachments
Backtrace (29.97 KB, text/plain)
2023-02-22 13:50 UTC, P. Adam Sowa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description P. Adam Sowa 2023-02-22 13:49:01 UTC
SUMMARY
The application crashes when an invalid symbolic link is encountered.

STEPS TO REPRODUCE
1. Create test dirs/files
```
mkdir dir_a dir_b
ln -s non_existing dir_b/bad_link
```
2.  Run: `kdiff3 dir_a dir_b`

OBSERVED RESULT
The application crashes with the message:
kdiff3: ./src/fileaccess.cpp:762: QDateTime FileAccess::lastModified() const: Assertion `!m_modificationTime.isNull()' failed.

EXPECTED RESULT
The application should not crash when an invalid symbolic link is encountered.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 22.04
KDE Plasma Version: 5.27.0
KDE Frameworks Version: 5.104.0
Qt Version: 5.15.8
Comment 1 P. Adam Sowa 2023-02-22 13:50:20 UTC
Created attachment 156604 [details]
Backtrace
Comment 2 michael 2023-02-23 17:04:31 UTC
Git commit 1a2d5eea2b48cbd8bc9a6c43db5260610b5f26ca by Michael Reeves.
Committed on 23/02/2023 at 17:00.
Pushed by mreeves into branch '1.10'.

Fix handling of broken links

QFileInfo::exists returns false for broken links
FIXED-IN:1.10.1
(cherry picked from commit 2b3645b8aef912f92d4a7c034141e1ef00fd22ed)

M  +1    -1    src/SourceData.cpp
M  +12   -2    src/fileaccess.cpp
M  +3    -0    src/fileaccess.h

https://invent.kde.org/sdk/kdiff3/commit/1a2d5eea2b48cbd8bc9a6c43db5260610b5f26ca
Comment 3 michael 2023-02-23 17:05:07 UTC
Git commit 9d5f7b6a6d146fcefe50e7a3d5cac897a0e8d0ac by Michael Reeves.
Committed on 23/02/2023 at 17:01.
Pushed by mreeves into branch 'master'.

Fix handling of broken links

QFileInfo::exists returns false for broken links
FIXED-IN:1.10.1

M  +1    -1    src/SourceData.cpp
M  +12   -2    src/fileaccess.cpp
M  +2    -0    src/fileaccess.h

https://invent.kde.org/sdk/kdiff3/commit/9d5f7b6a6d146fcefe50e7a3d5cac897a0e8d0ac
Comment 4 michael 2023-03-09 01:35:29 UTC
*** Bug 467086 has been marked as a duplicate of this bug. ***
Comment 5 Jaggz H. 2023-06-18 16:59:10 UTC
(In reply to michael from comment #4)
> *** Bug 467086 has been marked as a duplicate of this bug. ***

I wanted to point out that a similar crash is happening with two folders where ONE is missing u-x.
I'm possibly obnoxiously re-opening this bug since it'll be fresh on your mind, michael, in case it's in the same area of code.  Otherwise, please let me know if a new report is needed.

kdiff3: ./src/fileaccess.cpp:762: QDateTime FileAccess::lastModified() const: Assertion `!m_modificationTime.isNull()' failed.

To reproduce:
mkdir a b a/1 b/1 && echo x > a/1/test.txt && echo y > b/1/test.txt && chmod u-x a/1 && kdiff3 a b
Comment 6 Jaggz H. 2023-06-18 17:00:25 UTC
(Oh, note that I am not able to build with your broken symlink patch, but in reviewing the code I don't believe it fixes this perm-based one)
Comment 7 michael 2023-07-04 23:49:44 UTC
The !m_modificationTime.isNull() assertion no longer exists in kdiff3 source. It proved to be invalid due to the design of QDateTime::isNull(). Current 1.10 yields a conflicting type error in the permissions case but will no longer crash. That removal may not have been part of the same commit. Thanks.