Skip to content

Commit

Permalink
Permit any printable ASCII character in files/
Browse files Browse the repository at this point in the history
GLEP 33 says files/ entries should be within the ASCII range.
PMS does not make any further restrictions.

Exclude tilde (~) as this is commonly used by editors when saving backup
files.

One immediate benefit: this will allow for systemd template units to be
stored in files/ without mangling the filename. For example:

BannedCharacter: filename 'files/foo@.service' character outside allowed set: '@'

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
  • Loading branch information
floppym committed Jun 2, 2024
1 parent 257d394 commit 5efad2d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pkgcheck/checks/pkgdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
allowed_filename_chars.update(chr(x) for x in range(ord("0"), ord("9") + 1))
allowed_filename_chars.update([".", "-", "_", "+", ":"])

# allow any printable ascii character in FILESDIR
allowed_filesdir_chars = set(chr(x) for x in range(33, 126))


class MismatchedPN(results.PackageResult, results.Error):
"""Ebuilds that have different names than their parent directory."""
Expand Down Expand Up @@ -289,7 +292,7 @@ def feed(self, pkgset):
yield SizeViolation(
pjoin(base_dir, filename), file_stat.st_size, pkg=pkg
)
if banned_chars := set(filename) - allowed_filename_chars:
if banned_chars := set(filename) - allowed_filesdir_chars:
yield BannedCharacter(
pjoin(base_dir, filename), sorted(banned_chars), pkg=pkg
)
Expand Down

0 comments on commit 5efad2d

Please sign in to comment.