Skip to content

etc: Fixes for DependencyInstaller.sh#10037

Open
titan73 wants to merge 3 commits intoThe-OpenROAD-Project:masterfrom
titan73:master
Open

etc: Fixes for DependencyInstaller.sh#10037
titan73 wants to merge 3 commits intoThe-OpenROAD-Project:masterfrom
titan73:master

Conversation

@titan73
Copy link
Copy Markdown
Contributor

@titan73 titan73 commented Apr 2, 2026

No description provided.

titan73 added 2 commits April 2, 2026 19:06
The eval was lost in 9273cce.

Signed-off-by: Christian Costa <titan.costa@gmail.com>
…scription with them.

Signed-off-by: Christian Costa <titan.costa@gmail.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request modifies etc/DependencyInstaller.sh by adjusting the logging output in the _execute function and prepending eval to several wget commands across various installation functions. The review feedback consistently identifies the use of eval as a security risk that can lead to word-splitting issues, recommending the implementation of a shell function as a safer and more robust alternative for handling command aliases or flags.

cmake_checksum=${CMAKE_CHECKSUM_X86_64}
fi
_execute "Downloading CMake..." wget "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION_SMALL}/cmake-${CMAKE_VERSION_SMALL}-linux-${arch}.sh"
_execute "Downloading CMake..." eval wget "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION_SMALL}/cmake-${CMAKE_VERSION_SMALL}-linux-${arch}.sh"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using eval to force alias expansion is discouraged in shell scripts. It introduces security risks and can cause issues with word splitting if variables contain spaces. A more robust approach is to define a shell function instead of an alias for wget when the -nocert flag is used. This allows the command to be called normally without eval. For example, in the -nocert block, you could use: wget() { command wget --no-check-certificate "$@"; }

Suggested change
_execute "Downloading CMake..." eval wget "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION_SMALL}/cmake-${CMAKE_VERSION_SMALL}-linux-${arch}.sh"
_execute "Downloading CMake..." wget "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION_SMALL}/cmake-${CMAKE_VERSION_SMALL}-linux-${arch}.sh"

local url="${mirror}/bison-${BISON_VERSION}.tar.gz"
log "Trying to download bison from: $url"
if wget "$url"; then
if eval wget "$url"; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using eval here is risky. If the $url variable contains spaces or special characters, eval will cause the shell to re-parse the command, leading to incorrect argument splitting. Using a shell function instead of an alias for wget is a safer and cleaner alternative.

Suggested change
if eval wget "$url"; then
if wget "$url"; then

(
cd "${BASE_DIR}"
_execute "Downloading Flex..." wget https://github.com/westes/flex/releases/download/v${FLEX_VERSION}/flex-${FLEX_VERSION}.tar.gz
_execute "Downloading Flex..." eval wget https://github.com/westes/flex/releases/download/v${FLEX_VERSION}/flex-${FLEX_VERSION}.tar.gz
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Avoid using eval to expand aliases. Use a shell function for wget instead to maintain security and avoid word-splitting issues.

Suggested change
_execute "Downloading Flex..." eval wget https://github.com/westes/flex/releases/download/v${FLEX_VERSION}/flex-${FLEX_VERSION}.tar.gz
_execute "Downloading Flex..." wget https://github.com/westes/flex/releases/download/v${FLEX_VERSION}/flex-${FLEX_VERSION}.tar.gz

cd "${BASE_DIR}"
local tar_name="v${SWIG_VERSION}.tar.gz"
_execute "Downloading SWIG..." wget "https://github.com/swig/swig/archive/${tar_name}"
_execute "Downloading SWIG..." eval wget "https://github.com/swig/swig/archive/${tar_name}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Avoid using eval to expand aliases. Use a shell function for wget instead.

Suggested change
_execute "Downloading SWIG..." eval wget "https://github.com/swig/swig/archive/${tar_name}"
_execute "Downloading SWIG..." wget "https://github.com/swig/swig/archive/${tar_name}"

cd "${BASE_DIR}"
local pcre_tar_name="pcre2-${PCRE_VERSION}.tar.gz"
_execute "Downloading PCRE..." wget "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-${PCRE_VERSION}/${pcre_tar_name}"
_execute "Downloading PCRE..." eval wget "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-${PCRE_VERSION}/${pcre_tar_name}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Avoid using eval to expand aliases. Use a shell function for wget instead.

Suggested change
_execute "Downloading PCRE..." eval wget "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-${PCRE_VERSION}/${pcre_tar_name}"
_execute "Downloading PCRE..." wget "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-${PCRE_VERSION}/${pcre_tar_name}"

(
cd "${BASE_DIR}"
_execute "Downloading gtest..." wget "https://github.com/google/googletest/archive/refs/tags/v${GTEST_VERSION}.zip"
_execute "Downloading gtest..." eval wget "https://github.com/google/googletest/archive/refs/tags/v${GTEST_VERSION}.zip"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Avoid using eval to expand aliases. Use a shell function for wget instead.

Suggested change
_execute "Downloading gtest..." eval wget "https://github.com/google/googletest/archive/refs/tags/v${GTEST_VERSION}.zip"
_execute "Downloading gtest..." wget "https://github.com/google/googletest/archive/refs/tags/v${GTEST_VERSION}.zip"

(
cd "${BASE_DIR}"
_execute "Downloading Abseil..." wget "https://github.com/abseil/abseil-cpp/releases/download/${ABSL_VERSION}/abseil-cpp-${ABSL_VERSION}.tar.gz"
_execute "Downloading Abseil..." eval wget "https://github.com/abseil/abseil-cpp/releases/download/${ABSL_VERSION}/abseil-cpp-${ABSL_VERSION}.tar.gz"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Avoid using eval to expand aliases. Use a shell function for wget instead.

Suggested change
_execute "Downloading Abseil..." eval wget "https://github.com/abseil/abseil-cpp/releases/download/${ABSL_VERSION}/abseil-cpp-${ABSL_VERSION}.tar.gz"
_execute "Downloading Abseil..." wget "https://github.com/abseil/abseil-cpp/releases/download/${ABSL_VERSION}/abseil-cpp-${ABSL_VERSION}.tar.gz"

fi
local or_tools_file="or-tools_${arch}_${os}-${os_version}_cpp_v${OR_TOOLS_VERSION_SMALL}.tar.gz"
_execute "Downloading or-tools..." wget "https://github.com/google/or-tools/releases/download/v${OR_TOOLS_VERSION_BIG}/${or_tools_file}"
_execute "Downloading or-tools..." eval wget "https://github.com/google/or-tools/releases/download/v${OR_TOOLS_VERSION_BIG}/${or_tools_file}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Avoid using eval to expand aliases. Use a shell function for wget instead.

Suggested change
_execute "Downloading or-tools..." eval wget "https://github.com/google/or-tools/releases/download/v${OR_TOOLS_VERSION_BIG}/${or_tools_file}"
_execute "Downloading or-tools..." wget "https://github.com/google/or-tools/releases/download/v${OR_TOOLS_VERSION_BIG}/${or_tools_file}"

local arch=amd64
local pandoc_version="3.1.11.1"
_execute "Downloading pandoc..." wget "https://github.com/jgm/pandoc/releases/download/${pandoc_version}/pandoc-${pandoc_version}-linux-${arch}.tar.gz"
_execute "Downloading pandoc..." eval wget "https://github.com/jgm/pandoc/releases/download/${pandoc_version}/pandoc-${pandoc_version}-linux-${arch}.tar.gz"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Avoid using eval to expand aliases. Use a shell function for wget instead.

Suggested change
_execute "Downloading pandoc..." eval wget "https://github.com/jgm/pandoc/releases/download/${pandoc_version}/pandoc-${pandoc_version}-linux-${arch}.tar.gz"
_execute "Downloading pandoc..." wget "https://github.com/jgm/pandoc/releases/download/${pandoc_version}/pandoc-${pandoc_version}-linux-${arch}.tar.gz"


if _version_compare "${1}" -lt "24.04"; then
_execute "Downloading LLVM install script..." wget https://apt.llvm.org/llvm.sh
_execute "Downloading LLVM install script..." eval wget https://apt.llvm.org/llvm.sh
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Avoid using eval to expand aliases. Use a shell function for wget instead.

Suggested change
_execute "Downloading LLVM install script..." eval wget https://apt.llvm.org/llvm.sh
_execute "Downloading LLVM install script..." wget https://apt.llvm.org/llvm.sh

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

clang-tidy review says "All clean, LGTM! 👍"

@Divinesoumyadip
Copy link
Copy Markdown
Contributor

The eval approach for handling --no-check-certificate will work but it does introduce word-splitting risks if any URL variable ever contains spaces.
A cleaner way would be to define a shell function in the -nocert block:
wget() { command wget --no-check-certificate "$@"; }
This way all subsequent wget calls work normally without needing eval at all.

Signed-off-by: Christian Costa <titan.costa@gmail.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

clang-tidy review says "All clean, LGTM! 👍"

@titan73
Copy link
Copy Markdown
Contributor Author

titan73 commented Apr 2, 2026

I replaced the eval with a variable which is empty or with the nocert option

@maliberty
Copy link
Copy Markdown
Member

Please provide a description of the problem being fixed.

@titan73
Copy link
Copy Markdown
Contributor Author

titan73 commented Apr 4, 2026

Please provide a description of the problem being fixed.

I added the -nocert option to disable certificate checks as I had issue with my company firewall with 1234ff1.
It puts a alias on wget but as alias are expanded when the file is read and an eval was needed.
The "eval" was lost during a refactoring with 9273cce.

The 1st patch fixes that but actually I changed the method with the 3rd patch by using a variable OPT_NOCERT instead as Gemini complained.

The 2nd patch is unrelated and just cosmetic. When running the script. A message is printed with 6 dots:
Downloading CMake......
because 3 dots are printed in the _execute function:
echo -n "${BLUE}${BOLD}[INFO]${NC} ${description}..."
and for all the execute calls:
_execute "Downloading CMake..." wget XXX
The patch remove the redundant dots in _execute.

If needed,I can split the PR with patch 1 & 3 squashed and another for the patch 2.

@titan73 titan73 closed this Apr 4, 2026
@titan73 titan73 reopened this Apr 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

clang-tidy review says "All clean, LGTM! 👍"

@maliberty maliberty requested a review from sombraSoft April 6, 2026 14:41
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.

3 participants