-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Remove bash dep from init scripts #98781
Conversation
Tagging subscribers to this area: @dotnet/runtime-infrastructure Issue Detailsupstream changes dotnet/arcade#14500
|
illumos_*) | ||
nonPortableRid=openindiana-"$targetArch" | ||
;; | ||
__smartos_major_version=$(echo "$__uname_version" | cut -c9-10) |
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.
Is this a typo? Or is the range also 9-10?
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.
Bash syntax was 'skip 8 chars and select next two', new syntax is 'cut/select characters 9 and 10'.
VERSION_ID="${VERSION_ID%.*}" | ||
. "${rootfsDir}/etc/os-release" | ||
if [ "${ID}" = "rhel" ] || [ "${ID}" = "rocky" ] || [ "${ID}" = "alpine" ]; then | ||
VERSION_ID="${VERSION_ID%.*}" # Remove the last version digit for these distros |
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.
We stopped using it this trimming type of expansion for __solaris_major_version but not here. Is there difference in shell supports?
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.
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.
ChatGPT's reply:
If your target environments are systems that are 15 years old or newer, you are generally in a safe zone regarding the support for ${variable%pattern} parameter expansion. This feature is part of the POSIX standard, and most Unix-like systems from the last 15 years would have /bin/sh linked to a shell that supports POSIX parameter expansion
so advanced ops like substring extraction ${string:position:length}
are bash-specific. So I think we can safely use that parameter expansion syntax for now.
upstream changes dotnet/arcade#14500