[issue16584] unhandled IOError filecmp.cmpfiles() if file not readable
Till Maas added the comment: I just tried on a Windows 8 system with python from GIMP. The error occurs there as well if I compare two empty files after I removed permissions for one of the files. I do not know how to manage Windows' file ACLs in python, therefore I created the test case using the Explorer. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16584] unhandled IOError filecmp.cmpfiles() if file not readable
Changes by Terry J. Reedy tjre...@udel.edu: -- assignee: - terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16584] unhandled IOError filecmp.cmpfiles() if file not readable
Roundup Robot added the comment: New changeset 1823cf6e1084 by Terry Jan Reedy in branch '2.7': Issue 16584: in filecomp._cmp, catch IOError as well as os.error. http://hg.python.org/cpython/rev/1823cf6e1084 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16584] unhandled IOError filecmp.cmpfiles() if file not readable
Terry J. Reedy added the comment: I don't use filecmp and cannot reproduce problem on Windows, for reason stated, but this looks correct, so I am taking Till's word that this fixes the problem, at least for him. Intentionally applied to 2.7 only for reason stated by Andrew. Till, if you submit more patches, especially any that are not so trivial, please sign PSF Contributor Licence Agreement. http://www.python.org/psf/contrib/ -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16584] unhandled IOError filecmp.cmpfiles() if file not readable
Till Maas added the comment: When might this be patched in Python 2.X? This Exception makes the function pretty useless for me, since it makes by custom compare script crash. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16584] unhandled IOError filecmp.cmpfiles() if file not readable
Andrew Svetlov added the comment: The error can be reproduced for 2.7 and 3.2. Starting from 3.3 os.error and IOError both aliases for OSError and patch doesn't needed. -- nosy: +asvetlov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16584] unhandled IOError filecmp.cmpfiles() if file not readable
Terry J. Reedy added the comment: 3.3.0, Win 7, 64 bit, with print() and exception as e (which also works in 2.7 for more portable code ;-) (['testfile'], [], []) It this correct for Windows, where I believe chmod is a no-op? -- nosy: +terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16584] unhandled IOError filecmp.cmpfiles() if file not readable
Changes by Daniel Urban urban.dani...@gmail.com: -- stage: - patch review type: crash - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16584] unhandled IOError filecmp.cmpfiles() if file not readable
New submission from Till Maas: If filecmp is used with files that the user is not allowed to read, it creates an IOError exception instead of returning the file's name as an file that could not compared. The documentation says: http://docs.python.org/2/library/filecmp.html Returns three lists of file names: match, mismatch, errors. [...] errors lists the names of files which could not be compared. Files are listed in errors if they don’t exist in one of the directories, the user lacks permission to read them or if the comparison could not be done for some other reason. The attached file fails with an IOError: $ python filecmp-minimal.py Traceback (most recent call last): File filecmp-minimal.py, line 21, in module print filecmp.cmpfiles(join(t, a), join(t, b), [testfile], shallow=False) File /usr/lib64/python2.7/filecmp.py, line 258, in cmpfiles res[_cmp(ax, bx, shallow)].append(x) File /usr/lib64/python2.7/filecmp.py, line 270, in _cmp return not abs(cmp(a, b, sh)) File /usr/lib64/python2.7/filecmp.py, line 53, in cmp outcome = _do_cmp(f1, f2) File /usr/lib64/python2.7/filecmp.py, line 66, in _do_cmp with open(f1, 'rb') as fp1, open(f2, 'rb') as fp2: IOError: [Errno 13] Permission denied: '/tmp/tmpp93pmt/a/testfile' A quick glance at the current code in hg shows, that this bug is probably also present in all later Python versions than 2.7. I will attach a small patch that fixes this bug. -- components: Library (Lib) files: filecmp-minimal.py messages: 176700 nosy: till priority: normal severity: normal status: open title: unhandled IOError filecmp.cmpfiles() if file not readable type: crash versions: Python 2.7 Added file: http://bugs.python.org/file28168/filecmp-minimal.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16584] unhandled IOError filecmp.cmpfiles() if file not readable
Changes by Till Maas opensou...@till.name: -- keywords: +patch Added file: http://bugs.python.org/file28169/filecmp_exception.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com