After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 586656 - meld breaks when diffing directories that contain unreadable files
meld breaks when diffing directories that contain unreadable files
Status: RESOLVED FIXED
Product: meld
Classification: Other
Component: dirdiff
1.3.x
Other All
: Normal normal
: ---
Assigned To: Kai Willadsen
Stephen Kennedy
Depends on:
Blocks:
 
 
Reported: 2009-06-22 16:14 UTC by Max Naude
Modified: 2011-02-05 22:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
This patch stops meld from breaking when diffing directories that contain unreadable files (921 bytes, patch)
2009-06-22 16:18 UTC, Max Naude
none Details | Review
Patch partially implementing proposed error behaviour (2.22 KB, patch)
2009-06-25 08:39 UTC, Kai Willadsen
none Details | Review

Description Max Naude 2009-06-22 16:14:19 UTC
Please describe the problem:
When diffing directories, meld stops whenever it encounters a file that it
can't read ('permission denied').

It should ignore unreadable files in accordance to the way it handles similar
io-errors and continue to diff the rest of the files and directories.


Steps to reproduce:
1.  mkdir -p meld/test1/a meld/test1/b meld/test2/a meld/test2/b
2.  touch meld/test1/a/test.txt meld/test1/b/test.txt meld/test2/a/test.txt meld/test2/b/test.txt
3.  chmod 100 meld/test1/a/test.txt
4.  /opt/meld-1.3.0/meld /tmp/meld/test1 /tmp/meld/test2

Actual results:
meld stops when it encounters the unreadable file with the following traceback:

Traceback (most recent call last):
  • File "/opt/meld-1.3.0/task.py", line 130 in iteration
    ret = task()
  • File "/opt/meld-1.3.0/dirdiff.py", line 477 in _search_recursively_iter
    allfiles = self._filter_on_state( roots, accumfiles.get() )
  • File "/opt/meld-1.3.0/dirdiff.py", line 755 in _filter_on_state
    if _files_same( curfiles, self.regexes ):
  • File "/opt/meld-1.3.0/dirdiff.py", line 81 in _files_same
    contents = [ open(f, "r").read() for f in lof ]
IOError: [Errno 13] Permission denied: '/tmp/meld/test1/a/test.txt'

Nothing following the unreadable file is diffed.

Expected results:
meld should ignore the IOError and continue diffing the rest of the files and directories.

Does this happen every time?
Yes

Other information:
This can be resolved gracefully with a simple try-except block around the code that parses files - around line 755 in dirdiff.py
Comment 1 Max Naude 2009-06-22 16:18:03 UTC
Created attachment 137182 [details] [review]
This patch stops meld from breaking when diffing directories that contain unreadable files
Comment 2 Kai Willadsen 2009-06-25 08:38:19 UTC
I agree that Meld should deal with this case, but I'm not convinced that simply ignoring the IOError is the right thing to do. Having unreadable files in compared directories is probably something that a user would want to know about.

Rather than just skipping unreadable files, I think we should make sure that the problem is visible in the treeview, though I'm not sure exactly how this should work. I'm attaching a first pass at a patch that gives the file an error state... it's still pretty rough though.

Does this behaviour seem reasonable?
Comment 3 Kai Willadsen 2009-06-25 08:39:59 UTC
Created attachment 137353 [details] [review]
Patch partially implementing proposed error behaviour
Comment 4 Max Naude 2009-06-26 08:55:31 UTC
I agree it'd probably be better to notify the user.

I've not managed to implement the patch yet - I'm using 1.3.0 and it looks like the patch is for >1.3.0 (I'm missing the one_isdir[j] = isdir statement in my environment).  

I'll get the latest from the repos and try again soon.
Comment 5 Kai Willadsen 2011-02-05 22:56:41 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.