diff --git a/rpmlint/checks/FilesCheck.py b/rpmlint/checks/FilesCheck.py index d60f3e350..8ebb01142 100644 --- a/rpmlint/checks/FilesCheck.py +++ b/rpmlint/checks/FilesCheck.py @@ -339,12 +339,18 @@ def find_perm_in_tmpfiles(pkg, fname): fname = os.path.realpath(fname) for k, v in pkg.files.items(): - if 'tmpfiles.d' not in k: + if 'tmpfiles.d' not in k or not k.endswith('.conf'): continue if not os.path.exists(v.path) or os.path.isdir(v.path): continue + with open(v.path) as f: - tmpd += f.readlines() + try: + tmpd += f.readlines() + except ValueError: + # Can't read this file, so we are not trying to read definition + # from there + pass for line in tmpd: if f' {fname} ' not in line: diff --git a/test/test_files.py b/test/test_files.py index 804fc3b64..920e4ef56 100644 --- a/test/test_files.py +++ b/test/test_files.py @@ -376,6 +376,7 @@ def test_files_without_perms(package, output, test): """ }, '/etc/tmpfiles.d': {'is_dir': True}, + '/etc/tmpfiles.d/binary.zip': {'content': b'\xa0\x1b'}, }, ), ])