Skip to content

Conversation

@bmastbergen
Copy link
Collaborator

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

Copy link

Copilot AI left a 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_VERSION variable
  • 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.

Copy link

Copilot AI left a 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)
Copy link

Copilot AI Dec 4, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Copy link
Contributor

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.

Copy link
Collaborator Author

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!

roxanan1996
roxanan1996 previously approved these changes Dec 8, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants