GNOME Bugzilla – Bug 586656
meld breaks when diffing directories that contain unreadable files
Last modified: 2011-02-05 22:56:41 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):
+ Trace 216132
ret = task()
allfiles = self._filter_on_state( roots, accumfiles.get() )
if _files_same( curfiles, self.regexes ):
contents = [ open(f, "r").read() for f in lof ]
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
Created attachment 137182 [details] [review] This patch stops meld from breaking when diffing directories that contain unreadable files
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?
Created attachment 137353 [details] [review] Patch partially implementing proposed error behaviour
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.
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.