Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: sort.py: filter empty and duplicate items #6261

Merged
merged 1 commit into from
Mar 8, 2024

Conversation

kmk3
Copy link
Collaborator

@kmk3 kmk3 commented Mar 3, 2024

Note: This seems to already be done for protocol lines.

Before:

$ ./contrib/sort.py test.profile
sort.py: checking 1 profile(s)...
test.profile:1:-private-etc ,,bar,,foo,,bar,,,
test.profile:1:+private-etc ,,,,,,,bar,bar,foo
test.profile:2:-protocol ,,unix,,bluetooth,,unix,,inet,,,
test.profile:2:+protocol unix,inet,bluetooth
[ Fixed ] test.profile

After:

$ ./contrib/sort.py test.profile
sort.py: checking 1 profile(s)...
test.profile:1:-private-etc ,,bar,,foo,,bar,,,
test.profile:1:+private-etc bar,foo
test.profile:2:-protocol ,,unix,,bluetooth,,unix,,inet,,,
test.profile:2:+protocol unix,inet,bluetooth
[ Fixed ] test.profile

@kmk3 kmk3 requested a review from rusty-snake March 3, 2024 10:59
Note: This seems to already be done for `protocol` lines.

Before:

    $ ./contrib/sort.py test.profile
    sort.py: checking 1 profile(s)...
    test.profile:1:-private-etc ,,bar,,foo,,bar,,,
    test.profile:1:+private-etc ,,,,,,,bar,bar,foo
    test.profile:2:-protocol ,,unix,,bluetooth,,unix,,inet,,,
    test.profile:2:+protocol unix,inet,bluetooth
    [ Fixed ] test.profile

After:

    $ ./contrib/sort.py test.profile
    sort.py: checking 1 profile(s)...
    test.profile:1:-private-etc ,,bar,,foo,,bar,,,
    test.profile:1:+private-etc bar,foo
    test.profile:2:-protocol ,,unix,,bluetooth,,unix,,inet,,,
    test.profile:2:+protocol unix,inet,bluetooth
    [ Fixed ] test.profile
@kmk3 kmk3 changed the title build: sort.py: strip leading/trailing commas build: sort.py: filter empty and duplicate items Mar 3, 2024
@kmk3
Copy link
Collaborator Author

kmk3 commented Mar 3, 2024

(Made it remove duplicates as well)

@kmk3 kmk3 merged commit c16f7a2 into netblue30:master Mar 8, 2024
5 checks passed
@kmk3 kmk3 deleted the sort-py-strip-commas branch March 8, 2024 13:14
kmk3 added a commit that referenced this pull request Mar 14, 2024
kmk3 added a commit to kmk3/firejail that referenced this pull request Mar 24, 2024
This allows checking if sort.py correctly sorts the relevant lines in a
profile without having to overwrite it, which makes debugging and
testing easier (for example, in netblue30#6261).

Note: If it finds items that are not sorted, it still sorts them, prints
the diff and returns an error.
kmk3 added a commit to kmk3/firejail that referenced this pull request Mar 24, 2024
Similarly to `sed -i` and `perl -i`.

This allows checking if sort.py correctly sorts the relevant lines in a
profile without having to overwrite it, which makes debugging and
testing easier (for example, in netblue30#6261).

Note: If it finds items that are not sorted, it still sorts them, prints
the diff and returns an error.
kmk3 added a commit that referenced this pull request Mar 25, 2024
Similarly to `sed -i` and `perl -i`.

This allows checking if sort.py correctly sorts the relevant lines in a
profile without having to overwrite it, which makes debugging and
testing easier (for example, in #6261).

Note: If it finds items that are not sorted, it still sorts them, prints
the diff and returns an error.
@kmk3 kmk3 added the enhancement New feature request label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature request
Projects
Status: Done (on RELNOTES)
Development

Successfully merging this pull request may close these issues.

3 participants