-
-
Notifications
You must be signed in to change notification settings - Fork 251
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
Use standard sed syntax for translating filenames #4072
Conversation
Signed-off-by: Stewart X Addison <[email protected]>
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 mentioned reasoning is correct, the '|' operator is not available in basic regexp only extended. The workaround works well imho after doing a test.
@@ -2094,7 +2094,9 @@ getTargetFileNameForComponent() { | |||
echo "${target_file_name}" | sed "s/-jdk/-${component}/" | |||
else | |||
# if no pattern is found, append the component name right before the extension. | |||
echo "${target_file_name}" | sed -r "s/(.+)(\.tar\.gz|\.zip)/\1-${component}\2/" | |||
echo "${target_file_name}" | sed \ |
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.
Worth adding a comment about using Solaris friendly sed? I've seen a few cases where this sort of thing gets reverted by Linux focused folks :-)
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.
Isn't shell check able to to check posix? But I guess that is syntax only and not sed/grep and others...
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.
Worth adding a comment about using Solaris friendly sed? I've seen a few cases where this sort of thing gets reverted by Linux focused folks :-)
I have a view on that ... If we think we really need to tell people explictly "Don't change this to a non-standard syntax" I can add it (such things aren't just for Solaris)... however I feel adding such comments everywhere would be a job for life ;-) "Linux folks" need to be aware that this isn't just a Linux project when copying stuff from stackoverflow/ChatGPT etc. ;-)
Isn't shell check able to to check posix? But I guess that is syntax only and not sed/grep and others...
I suspect so yeah. There have also been cases where we have used if
blocks to explicitly check for and use non-standard versions, so they'd have to be skipped.
Signed-off-by: Stewart X Addison <[email protected]>
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.
Looks good :)
Solaris's
sed
doesn't support the-r
parameter. Since I believe this was only required for the OR section on the extension I've split it out into two separeate-e
parameters for sed. One for the.tar.gz
case and the other for.zip
. I've also escaped the brackets.To test:
Noting that even on Linux the original version was likely not working:
Testing at https://ci.adoptium.net/job/build-scripts/job/jobs/job/jdk8u/job/jdk8u-solaris-x64-temurin-simple/17/
Identified as part of adoptium/infrastructure#3742