Skip to content

Commit

Permalink
Merge pull request #1259 from rpm-software-management/fix-files-check…
Browse files Browse the repository at this point in the history
…-bin

FilesCheck: Fix zero perm check with binaries
  • Loading branch information
danigm authored Aug 2, 2024
2 parents 78f9ad0 + 2ee228f commit 19447ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions rpmlint/checks/FilesCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions test/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'},
},
),
])
Expand Down

0 comments on commit 19447ac

Please sign in to comment.