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

Conversation

judovana
Copy link
Contributor

the main argument have actually very strict format of jdk8, jdk8u...,jdk, the build may fail later if this is not honoured.

If your repository have different name, have to go with --version or build from dir/snapshot

makejdk-any-platform.1 Outdated Show resolved Hide resolved
makejdk-any-platform.1 Outdated Show resolved Hide resolved
sbin/common/common.sh Outdated Show resolved Hide resolved
sbin/common/common.sh Outdated Show resolved Hide resolved
sbin/common/common.sh Outdated Show resolved Hide resolved
sbin/common/common.sh Outdated Show resolved Hide resolved
judovana and others added 6 commits April 1, 2024 10:11
@judovana
Copy link
Contributor Author

judovana commented Apr 1, 2024

@karianna thanx a lot for eyball. Sorry for the spell check. I will be more cautious next time. All suggestions followed and commit.

@judovana
Copy link
Contributor Author

judovana commented Apr 1, 2024

 $  sh makejdk-any-platform.sh  jdkXblah
Starting makejdk-any-platform.sh to configure, build (Adoptium)OpenJDK binary
The mandatory repo argument has a very strict format 'jdk[0-9]{1,3}[u]{0,1}' or just plain 'jdk' for tip. 'jdkXblah' does not match.
This can be worked around by using '--version jdkXYu'. If set (and matching) then the main argument can have any value.

 $  sh makejdk-any-platform.sh  --version jdkXblah
Starting makejdk-any-platform.sh to configure, build (Adoptium)OpenJDK binary
Parsing opt: --version
Possible opt arg: jdkXblah
The mandatory repo argument has a very strict format 'jdk[0-9]{1,3}[u]{0,1}' or just plain 'jdk' for tip. 'jdkXblah' does not match.
This can be worked around by using '--version jdkXYu'. If set (and matching) then the main argument can have any value.

 $  sh makejdk-any-platform.sh  --version jdkXblah jdk11u
Starting makejdk-any-platform.sh to configure, build (Adoptium)OpenJDK binary
Parsing opt: --version
Possible opt arg: jdkXblah
The mandatory repo argument has a very strict format 'jdk[0-9]{1,3}[u]{0,1}' or just plain 'jdk' for tip. 'jdkXblah' does not match.
This can be worked around by using '--version jdkXYu'. If set (and matching) then the main argument can have any value.

 $  sh makejdk-any-platform.sh  --version jdk11u jdkXblah #pass
Starting makejdk-any-platform.sh to configure, build (Adoptium)OpenJDK binary
Parsing opt: --version
Possible opt arg: jdk11u
Working dir is ./build/
[debug] COPY_MACOSX_FREE_FONT_LIB_FOR_JDK_FLAG=false
[debug] COPY_MACOSX_FREE_FONT_LIB_FOR_JRE_FLAG=false
JDK Image folder name: jdk
JRE Image folder name: jre
Skipping setting boot JDK on docker host machine
# ============================
# OPENJDK BUILD CONFIGURATION:
# ============================
...
Terminated

 $  sh makejdk-any-platform.sh  jdk #pass
...
featureNumber FOUND: 23
Working dir is ./build/
[debug] COPY_MACOSX_FREE_FONT_LIB_FOR_JDK_FLAG=false
[debug] COPY_MACOSX_FREE_FONT_LIB_FOR_JRE_FLAG=false
JDK Image folder name: jdk
JRE Image folder name: jre
Skipping setting boot JDK on docker host machine
# ============================
# OPENJDK BUILD CONFIGURATION:
# ============================
...
Terminated

@judovana judovana requested a review from karianna April 2, 2024 17:38
sbin/common/common.sh Outdated Show resolved Hide resolved
Co-authored-by: Martijn Verburg <[email protected]>
Copy link
Member

@sxa sxa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the scenario where you'd want to use --version jdk11u jdkXblah?
Normally I'd hope you can just do something like -r https://github.com/sxa/myjdkrepo jdk21u if you want to use a non-default repository for the JDK source - does that not work for your use case?

@judovana
Copy link
Contributor Author

judovana commented Apr 3, 2024

What is the scenario where you'd want to use --version jdk11u jdkXblah? Normally I'd hope you can just do something like -r https://github.com/sxa/myjdkrepo jdk21u if you want to use a non-default repository for the JDK source - does that not work for your use case?

Tbh, I'm not sure with that scenario. I was pointing out how that works, so you can be sure it behaves correctly (at least how I understand the correctness here). I had learned, that the --version served for weirdly named forks on the default jdks, on default url. Eg jdk8u-shenandoah or riscv-port-jdk11u. so sh makejdk-any-platform.sh --version jdk11u riscv-port-jdk11u is working as expected, as riscv-port-jdk11u is not asserted, because --version jdk11u was.

The -r would work similarly: bash makejdk-any-platform.sh -r "https://github.com/gnu-andrew/shenandoah-jdk8u" --tag shenandoah8u412-b01 jdk8u will pass the assert on jdk8u as the -r is not checked at all.

Unluckilly above example fails on freetype:
(and so woud die bash makejdk-any-platform.sh -r "https://github.com/gnu-andrew/shenandoah-jdk8u" --tag jdk8u412-b01 jdk8u

Cloning into 'freetype'...
remote: Enumerating objects: 90847, done.
remote: Counting objects: 100% (3762/3762), done.
remote: Compressing objects: 100% (1210/1210), done.
remote: Total 90847 (delta 2673), reused 3435 (delta 2541), pack-reused 87085
Receiving objects: 100% (90847/90847), 30.36 MiB | 20.40 MiB/s, done.
Resolving deltas: 100% (74638/74638), done.
Note: switching to '86bc8a95056c97a810986434a3f268cbe67f2902'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 86bc8a950 * Version 2.9.1 released. =========================
./autogen.sh: line 102: libtoolize: command not found
./autogen.sh: line 55: test: 2: unary operator expected
./autogen.sh: line 59: test: 2: unary operator expected
./autogen.sh: line 67: test: 2: unary operator expected
./autogen.sh: line 71: test: 2: unary operator expected
generating `configure.ac'
running `aclocal -I . --force'
running `libtoolize --force --copy --install'
./autogen.sh: line 15: libtoolize: command not found
error while running `libtoolize --force --copy --install'

but I doubt this patch is guilty.

the bash makejdk-any-platform.sh -r "https://github.com/gnu-andrew/shenandoah-jdk8u" --tag shenandoah8u412-b01 -f /usr/lib64/libfreetype.so -F jdk8u should work out of the box.

@judovana judovana requested a review from sxa April 3, 2024 12:41
@judovana
Copy link
Contributor Author

ping please?

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A block has been put on this Pull Request as this repository is temporarily under a code freeze due to an ongoing release cycle.

If this pull request needs to be merged during the release cycle then please comment /merge and a PMC member will be able to remove the block.

If the code freeze is over you can remove this block by commenting /thaw.

Copy link
Contributor

@andrew-m-leonard andrew-m-leonard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@judovana
Copy link
Contributor Author

Looks like this can go in. merge please?

@andrew-m-leonard
Copy link
Contributor

/thaw

@github-actions github-actions bot dismissed their stale review April 26, 2024 07:49

Pull Request unblocked - code freeze is over.

@andrew-m-leonard andrew-m-leonard merged commit c3c4a96 into adoptium:master Apr 26, 2024
22 of 23 checks passed
@sxa
Copy link
Member

sxa commented May 2, 2024

This is causing me a problem (illegal option) on Solaris where grep -q -e -e doesn't work

@judovana
Copy link
Contributor Author

judovana commented May 2, 2024

Damn. And what works? grep -q -e blah ? grep -q blah or the -e -e ?
If the first, I will split the grep to two, if the last, I will redirect to /dev/null if both, then both....

@sxa
Copy link
Member

sxa commented May 2, 2024

Looked like it objected to all of those unfortunately:

grep: illegal option -- q
grep: illegal option -- e
Usage: grep -hblcnsviw pattern file . . .

egrep should be usable in place of grep -e although I don't think it'll accept multiple -e parameters properly. I can try and have a bit more of an experiment with it tomorrow.

@judovana
Copy link
Contributor Author

judovana commented May 2, 2024

Ok. Will draft PR wihtout -e and -q. Sorry!

@judovana
Copy link
Contributor Author

judovana commented May 2, 2024

Something like #3788 but it is jjust quick draft before night. but not sure waht to do better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants