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

Added check to prevent input of invalid repo as main argument #3728

Merged
merged 12 commits into from
Apr 26, 2024
3 changes: 3 additions & 0 deletions makejdk-any-platform.1
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ that you are building for further details.

This will start a Docker container and build you the latest Java 8 Temurin
binary from the source at https://github.com/adoptium/openjdk-jdk8u
Note that the main argument, in this case jdk8, is compared and enforced
against an enumeration - jdk8, jdk8u, ... jdk21, jdk21u, ...jdk. Nothing else.
You can workaround this by \-\-version switch.

Please visit https://www.adoptium.net for further support

Expand Down
11 changes: 11 additions & 0 deletions sbin/common/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@
function setOpenJdkVersion() {
local forest_name=$1

# The argument passed here have actually very strict format of jdk8, jdk8u..., jdk
# the build may fail later if this is not honoured.
# If your repository has a different name, you can use --version or build from dir/snapshot
local forest_name_check=0
echo "$forest_name" | grep -q -e "^jdk$" -e "^jdk[0-9]\\{1,3\\}[u]\\{0,1\\}$" || forest_name_check=$?
if [ ${forest_name_check} -ne 0 ]; then
echo "The mandatory repo argument has a very strict format 'jdk[0-9]{1,3}[u]{0,1}' or just plain 'jdk' for tip. '$forest_name' does not match."
echo "This can be worked around by using '--version jdkXYu'. If set (and matching) then the main argument can have any value."
exit 1
fi

# Derive the openjdk_core_version from the forest name.
local openjdk_core_version=${forest_name}
if [[ ${forest_name} == *u ]]; then
Expand Down
Loading