-
Notifications
You must be signed in to change notification settings - Fork 1
[LTR] Infer kernel version from UPSTREAM_REF #49
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
base: mainline
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the lt_rebase.sh script to dynamically infer the kernel version from the UPSTREAM_REF parameter instead of hardcoding version "6.12". This enables the script to work seamlessly with different kernel versions (e.g., stable_6.18.y) by extracting the version number and constructing all branch references dynamically.
Key changes:
- Added kernel version extraction logic using regex pattern matching on
UPSTREAM_REF - Replaced all hardcoded "6.12" references with the dynamically extracted
KERNEL_VERSIONvariable - Added validation and error handling for version extraction with clear error messages
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
efbddb9 to
fb5f4c4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lt_rebase.sh
Outdated
|
|
||
| # Validate UPSTREAM_REF format to prevent shell injection | ||
| case "$UPSTREAM_REF" in | ||
| stable_[0-9]*.[0-9]*.y) |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validation pattern stable_[0-9]*.[0-9]*.y uses glob patterns which are more permissive than intended. This would accept invalid formats like stable_123.y (missing second version number) or stable_.1.y (missing first version number). Consider using a more restrictive pattern like stable_[0-9]*[0-9].[0-9]*[0-9].y or handle validation in the extraction step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see a condition where the upstream forgets to label this correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UPSTREAM_REF is optionally assigned by command line argument here, so this is just some validation that it is a reasonable value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would replace '*" with '+' to be the same as the regex below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, good call. I made the regexs the same. Thanks!
Use the inferred kernel version to construct all of the other branch references in the script. This should allow an UPSTREAM_REF of stable_6.18.y to be passed and the script to work the same way it does today for 6.12
fb5f4c4 to
e711b0d
Compare
Use the inferred kernel version to construct all of the other branch references in the script. This should allow an UPSTREAM_REF of stable_6.18.y to be passed and the script to work the same way it does today for 6.12