Bug 403089 - kdiff3 fails comparing directories
Summary: kdiff3 fails comparing directories
Status: RESOLVED FIXED
Alias: None
Product: kdiff3
Classification: Applications
Component: application (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: michael
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-11 06:14 UTC by Vasiliy Glazov
Modified: 2019-01-18 22:08 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 1.7.90


Attachments
attachment-26971-0.html (3.35 KB, text/html)
2019-01-15 17:00 UTC, michael
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vasiliy Glazov 2019-01-11 06:14:29 UTC
SUMMARY
When comparing directories, the tree show all files are always different. When double-click a file instead it recognizes than the files are 'binary equal'

I have traced an execution with 'strace kdiff3 dir1 dir2':

...
statx(AT_FDCWD, "/tmp/dir1/file", AT_STATX_SYNC_AS_STAT|AT_SYMLINK_NOFOLLOW, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=5, ...}) = 0
...
statx(AT_FDCWD, "/tmp/dir2/file", AT_STATX_SYNC_AS_STAT|AT_SYMLINK_NOFOLLOW, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=5, ...}) = 0
...
openat(AT_FDCWD, "file", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
...

When program is getting both directory trees it access files using full path. But when it try to read the file it forget to add the path to the file name, neither do a previous 'chdir()'


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 29
(available in About System)
KDE Plasma Version: 5.14.4
KDE Frameworks Version: 5.53.0
Qt Version: 5.11.3

ADDITIONAL INFORMATION
Compiled last version from git repository at 'https://github.com/KDE/kdiff3' has not only this bug but also there is a new bug. When try to compare only two directories it fails because it requires the third directory 'C' that should be optional.

Original bugreport https://bugzilla.redhat.com/show_bug.cgi?id=1664996
Comment 1 michael 2019-01-15 17:00:35 UTC
Created attachment 117474 [details]
attachment-26971-0.html

The regressions are fixed in master. However the handling of the temp files
used for network comparisons is still wrong. This was true for the original
code as well. I will close this when the tempfiles are handled correctly.

On Fri, Jan 11, 2019, 1:14 AM Vasiliy Glazov <bugzilla_noreply@kde.org
wrote:

> https://bugs.kde.org/show_bug.cgi?id=403089
>
>             Bug ID: 403089
>            Summary: kdiff3 fails comparing directories
>            Product: kdiff3
>            Version: unspecified
>           Platform: Fedora RPMs
>                 OS: Linux
>             Status: REPORTED
>           Severity: normal
>           Priority: NOR
>          Component: application
>           Assignee: reeves.87@gmail.com
>           Reporter: vascom2@gmail.com
>   Target Milestone: ---
>
> SUMMARY
> When comparing directories, the tree show all files are always different.
> When
> double-click a file instead it recognizes than the files are 'binary equal'
>
> I have traced an execution with 'strace kdiff3 dir1 dir2':
>
> ...
> statx(AT_FDCWD, "/tmp/dir1/file",
> AT_STATX_SYNC_AS_STAT|AT_SYMLINK_NOFOLLOW,
> STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0,
> stx_mode=S_IFREG|0644, stx_size=5, ...}) = 0
> ...
> statx(AT_FDCWD, "/tmp/dir2/file",
> AT_STATX_SYNC_AS_STAT|AT_SYMLINK_NOFOLLOW,
> STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0,
> stx_mode=S_IFREG|0644, stx_size=5, ...}) = 0
> ...
> openat(AT_FDCWD, "file", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or
> directory)
> ...
>
> When program is getting both directory trees it access files using full
> path.
> But when it try to read the file it forget to add the path to the file
> name,
> neither do a previous 'chdir()'
>
>
> SOFTWARE/OS VERSIONS
> Linux/KDE Plasma: Fedora 29
> (available in About System)
> KDE Plasma Version: 5.14.4
> KDE Frameworks Version: 5.53.0
> Qt Version: 5.11.3
>
> ADDITIONAL INFORMATION
> Compiled last version from git repository at '
> https://github.com/KDE/kdiff3'
> has not only this bug but also there is a new bug. When try to compare
> only two
> directories it fails because it requires the third directory 'C' that
> should be
> optional.
>
> Original bugreport https://bugzilla.redhat.com/show_bug.cgi?id=1664996
>
> --
> You are receiving this mail because:
> You are the assignee for the bug.
Comment 2 Vasiliy Glazov 2019-01-15 18:38:07 UTC
Thanks.
I will test it and update package for Fedora.
Comment 3 michael 2019-01-18 22:08:18 UTC
Git commit 13922740e55bc4886123fb99f08318453aa42eda by Michael Reeves.
Committed on 18/01/2019 at 22:05.
Pushed by mreeves into branch 'master'.

fix fastFileComparison for network files
FIXED-IN:1.7.90

This fixes the handling of tempfiles created during network comparsion.
Previously these would be accessed by name alone causing an error.
Now QTemparyFile is used were needed.
Direct use of QFile for file operations is now depriated as this is
diffcualt to get right given the use of a tempFile in some cases.
*open,close, read routines created in FileAccess to currectly handle the
tempfile logic and error messages.
*Fix this issue exists within FileAccess::readFile() as well.

M  +9    -34   src/directorymergewindow.cpp
M  +65   -14   src/fileaccess.cpp
M  +12   -3    src/fileaccess.h

https://commits.kde.org/kdiff3/13922740e55bc4886123fb99f08318453aa42eda