RFR: 7903765: wget failed in build.sh in jtreg

Jaikiran Pai jpai at openjdk.org
Fri Jul 5 05:47:29 UTC 2024


On Tue, 2 Jul 2024 13:03:06 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:

> I tried to build jtreg, but it failed as following:
> 
> 
> $ bash make/build.sh --jdk /usr/lib/jvm/java-22-ope
> njdk
> [build.sh][INFO] CYGWIN_OR_MSYS=0
> [build.sh][INFO] JAVA_HOME: /usr/lib/jvm/java-22-openjdk
> [build.sh][INFO] Downloading https://archive.apache.org/dist/ant/binaries/apache-ant-1.10.8-bin.zip to /home/ysuenaga/github-forked/jtreg/make/../build/deps/apache-ant-1.10.8-bin.zip
> [build.sh][ERROR] wget exited with exit code 1
> 
> 
> I tried it on Fedora 40, wget is from wget2-wget-2.1.0-9.fc40.x86_64 . Related path seems not to be accepted in this version at least.

It's strange that wget is complaining for that path. Instead of using `realpath` at the call site, can you see the following patch works on your setup. What it does is, it avoids the use of `..` in paths that these scripts use:


diff --git a/make/build-support/asmtools/build.sh b/make/build-support/asmtools/build.sh
index 0d2762f..0662d56 100644
--- a/make/build-support/asmtools/build.sh
+++ b/make/build-support/asmtools/build.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 #
-# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -42,8 +42,8 @@ setup_asmtools_src() {
     check_arguments "${FUNCNAME}" 1 $#
 
     local dir="$1"
-
-    local ASMTOOLS_LOCAL_SRC_ARCHIVE="${dir}/../source.zip"
+    local src_archive_dir="$(builtin  cd ${dir}/..; pwd)"
+    local ASMTOOLS_LOCAL_SRC_ARCHIVE="${src_archive_dir}/source.zip"
     if [ "${ASMTOOLS_SRC_TAG}" = "tip" -o "${ASMTOOLS_SRC_TAG}" = "master" ]; then
         local BRANCH="master"
         get_archive_no_checksum "${CODE_TOOLS_URL_BASE}/asmtools/archive/${BRANCH}.zip" "${ASMTOOLS_LOCAL_SRC_ARCHIVE}" "${dir}"
@@ -58,6 +58,7 @@ build_asmtools() {
     check_arguments "${FUNCNAME}" 0 $#
 
     local ASMTOOLS_SRC_DIR_BASE="${BUILD_DIR}/src"
+    mkdir -p "${ASMTOOLS_SRC_DIR_BASE}"
     setup_asmtools_src "${ASMTOOLS_SRC_DIR_BASE}"
 
     local ASMTOOLS_DIST="${BUILD_DIR}/build"
diff --git a/make/build-support/build-common.sh b/make/build-support/build-common.sh
index e5603ea..938fe41 100644
--- a/make/build-support/build-common.sh
+++ b/make/build-support/build-common.sh
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -311,8 +311,8 @@ if [ -z "${log_module:-}" ]; then
     error "log_module not set in caller (line/file): $(caller)"
     exit 1
 fi
-
-ROOT="$(abspath ${ROOT:-${mydir}/..})"
+DEFAULT_ROOT="$(builtin cd ${mydir}/..; pwd)"
+ROOT="$(abspath ${ROOT:-${DEFAULT_ROOT}})"
 BUILD_DIR="$(abspath "${BUILD_DIR:-${ROOT}/build}")"
 DEPS_DIR="${BUILD_DIR}/deps"
 
diff --git a/make/build-support/jtharness/build.sh b/make/build-support/jtharness/build.sh
index f76a823..62ca0d4 100644
--- a/make/build-support/jtharness/build.sh
+++ b/make/build-support/jtharness/build.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 #
-# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,8 @@ setup_jtharness_source() {
     local dir="$1"
 
     # Build jtharness
-    local JTHARNESS_LOCAL_SRC_ARCHIVE="${dir}/../source.zip"
+    local src_archive_dir="$(builtin  cd ${dir}/..; pwd)"
+    local JTHARNESS_LOCAL_SRC_ARCHIVE="${src_archive_dir}/source.zip"
     if [ "${JTHARNESS_SRC_TAG}" = "tip" -o "${JTHARNESS_SRC_TAG}" = "master" ]; then
         local BRANCH="master"
         get_archive_no_checksum "${CODE_TOOLS_URL_BASE}/jtharness/archive/${BRANCH}.zip" "${JTHARNESS_LOCAL_SRC_ARCHIVE}" "${dir}"
@@ -61,6 +62,7 @@ build_jtharness() {
     check_arguments "${FUNCNAME}" 0 $#
 
     local JTHARNESS_SRC_DIR_BASE="${BUILD_DIR}/src"
+    mkdir -p "${JTHARNESS_SRC_DIR_BASE}"
     setup_jtharness_source "${JTHARNESS_SRC_DIR_BASE}"
 
     local JTHARNESS_DIST="${BUILD_DIR}/build"

-------------

PR Comment: https://git.openjdk.org/jtreg/pull/211#issuecomment-2210219575


More information about the jtreg-dev mailing list