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

naughty: handle fnmatch regex behaviour on Python 3.9 #5475

Merged
merged 1 commit into from
Oct 31, 2023

Conversation

jelly
Copy link
Member

@jelly jelly commented Oct 30, 2023

On Python 3.9 fnmatch cannot handle ["check-foo"] and gives an exception.

See cockpit-project/cockpit#17226

})(["January 1, 2037", ["check-journal", "AFTER BOOT", ""], ["", "Reboot", ""], ["check-journal", "BEFORE BOOT", ""]])): Uncaught (in promise) Error: condition did not become true
})(["January 1, 2037", ["check*journal", "AFTER BOOT", ""], ["", "Reboot", ""], ["check*journal", "BEFORE BOOT", ""]])): Uncaught (in promise) Error: condition did not become true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like the wrong fix. The root cause here is that the [] define character classes, but we really want to treat them verbatim. I.e. replacing the [ with \[ would feel more correct, unless fnmatch() doesn't deal with this? But I think we should avoid all fancy characters, and just use * liberally, like *January 1, 2037*check-journal*"BEFORE BOOT" or so.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we test this against centos-9-stream/fedora-39 here? That would be nice I think

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't run against TF (that needs to happen in cockpit, or tested locally), but you can/should trigger c9s/f39 tests against cockpit here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops, made the mistake of using image:fedora-39 so triggered a bit too much.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c9s can't be triggered sadly:

[jelle@t14s][~/projects/cockpit-bots]%./tests-trigger 5475 centos-9-stream/other@cockpit-project/cockpit
ignoring unknown context centos-9-stream/other@cockpit-project/cockpit

On Python 3.9 fnmatch cannot handle ["check-foo"] and gives an
exception.
@jelly jelly force-pushed the old-python-fnmatch branch from 78766f1 to bacca43 Compare October 31, 2023 09:07
Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM.

@jelly
Copy link
Member Author

jelly commented Oct 31, 2023

@jelly jelly merged commit d71dc21 into cockpit-project:main Oct 31, 2023
5 checks passed
@jelly jelly deleted the old-python-fnmatch branch October 31, 2023 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants