mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
build: sort.py: ignore empty files
Currently it adds a newline to empty files.
Before:
$ : >foo.profile
$ contrib/sort.py foo.profile
sort.py: checking 1 profile(s)...
foo.profile:(fixed whitespace)
[ Fixed ] foo.profile
$ od -A n -t x1 foo.profile
0a
After:
$ : >foo.profile
$ contrib/sort.py foo.profile
sort.py: checking 1 profile(s)...
$
This amends commit c222b7f69 ("build: sort.py: fix whitespace in entire
profile (#6593)", 2024-12-28).
This commit is contained in:
parent
8c28f0e386
commit
7b47c82d6b
1 changed files with 5 additions and 1 deletions
|
|
@ -76,7 +76,11 @@ def sort_protocol(original_protocols):
|
|||
|
||||
def check_profile(filename, overwrite):
|
||||
with open(filename, "r+") as profile:
|
||||
lines = profile.read().split("\n")
|
||||
original_profile_str = profile.read()
|
||||
if not original_profile_str:
|
||||
return
|
||||
|
||||
lines = original_profile_str.split("\n")
|
||||
was_fixed = False
|
||||
fixed_profile = []
|
||||
for lineno, original_line in enumerate(lines, 1):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue