[GH-ISSUE #3099] sort.py breaks on older python3 versions #1939

Closed
opened 2026-05-05 08:36:29 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @ghost on GitHub (Dec 27, 2019).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3099

After building firejail from git I always run the sort.py script from contrib to catch regressions. Usually I do this on my main Arch machine. That has python 3.8 and the script runs without issues. Recently I happened to run the checks on a Ubuntu 16.04 LTS machine, which has python 3.5 and saw it break:

$ /usr/lib/firejail/sort.py
File "/usr/lib/firejail/sort.py", line 77
    fixed_line = f"{line[:12]}{sort_alphabetical(line[12:])}"
                                                                                                     ^
SyntaxError: invalid syntax

@rusty-snake Perhaps we can support the handy script on older python versions?

Originally created by @ghost on GitHub (Dec 27, 2019). Original GitHub issue: https://github.com/netblue30/firejail/issues/3099 After building firejail from git I always run the `sort.py` script from contrib to catch regressions. Usually I do this on my main Arch machine. That has python 3.8 and the script runs without issues. Recently I happened to run the checks on a Ubuntu 16.04 LTS machine, which has python 3.5 and saw it break: ``` $ /usr/lib/firejail/sort.py File "/usr/lib/firejail/sort.py", line 77 fixed_line = f"{line[:12]}{sort_alphabetical(line[12:])}" ^ SyntaxError: invalid syntax ``` @rusty-snake Perhaps we can support the handy script on older python versions?
Author
Owner

@rusty-snake commented on GitHub (Dec 28, 2019):

Yes, the only new python feature in this script are format-strings (3.6+) replacing these with the "old" .format works with 3.4 and 3.5 (only tested these two).

sort.py.patch.txt GitHub why is .patch denied? 🙀

<!-- gh-comment-id:569405738 --> @rusty-snake commented on GitHub (Dec 28, 2019): Yes, the only new python feature in this script are format-strings (3.6+) replacing these with the "old" .format works with 3.4 and 3.5 (only tested these two). [sort.py.patch.txt](https://github.com/netblue30/firejail/files/4006950/sort.py.patch.txt) _GitHub why is .patch denied? :scream_cat:_
Author
Owner

@rusty-snake commented on GitHub (Dec 28, 2019):

8cd87fb5d6/contrib/sort.py (L22-L23)

<!-- gh-comment-id:569405831 --> @rusty-snake commented on GitHub (Dec 28, 2019): https://github.com/netblue30/firejail/blob/8cd87fb5d69006d7aa832b445b21a18f767c44dd/contrib/sort.py#L22-L23
Author
Owner

@ghost commented on GitHub (Dec 28, 2019):

@rusty-snake Thanks for the patch!

<!-- gh-comment-id:569408812 --> @ghost commented on GitHub (Dec 28, 2019): @rusty-snake Thanks for the patch!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#1939
No description provided.