ContinuumIO / anaconda-issues

Anaconda issue tracking
648 stars 223 forks source link

No error message is printed by installer when exiting with non-zero exit status #13189

Open dlmiles opened 1 year ago

dlmiles commented 1 year ago

Checklist

Impacted product

What happened?

bash-4.2$ /data/vlsi/open_pdks/sources/sky130-pdk/env/downloads/Miniconda3-latest-Linux-x86_64.sh -h

usage: /data/vlsi/open_pdks/sources/sky130-pdk/env/downloads/Miniconda3-latest-Linux-x86_64.sh [options]

Installs Miniconda3 py310_23.3.1-0

-b run install in batch mode (without manual intervention), it is expected the license terms (if any) are agreed upon -f no error if install prefix already exists -h print this help message and exit -p PREFIX install prefix, defaults to /openlane/miniconda3, must not contain spaces. -s skip running pre/post-link/install scripts -u update an existing installation -t run package tests after installation (may install conda-build)

bash-4.2$ sha1sum /data/vlsi/open_pdks/sources/sky130-pdk/env/downloads/Miniconda3-latest-Linux-x86_64.sh 715d92e17150debf45d7bf81c823df9da35d2988 /data/vlsi/open_pdks/sources/sky130-pdk/env/downloads/Miniconda3-latest-Linux-x86_64.sh bash-4.2$ ls -lad /data/vlsi/open_pdks/sources/sky130-pdk/env/conda ls: cannot access /data/vlsi/open_pdks/sources/sky130-pdk/env/conda: No such file or directory bash-4.2$ bash /data/vlsi/open_pdks/sources/sky130-pdk/env/downloads/Miniconda3-latest-Linux-x86_64.sh -p /data/vlsi/open_pdks/sources/sky130-pdk/env/conda -b -f PREFIX=/data/vlsi/open_pdks/sources/sky130-pdk/env/conda Unpacking payload ... bash-4.2$ echo $?
1 bash-4.2$ ls -lad /data/vlsi/open_pdks/sources/sky130-pdk/env/conda drwxr-xr-x 5 dlm dlm 4096 May 4 22:51 /data/vlsi/open_pdks/sources/sky130-pdk/env/conda bash-4.2$ du -s /data/vlsi/open_pdks/sources/sky130-pdk/env/conda 307012 /data/vlsi/open_pdks/sources/sky130-pdk/env/conda bash-4.2$ bash /data/vlsi/open_pdks/sources/sky130-pdk/env/downloads/Miniconda3-latest-Linux-x86_64.sh -p /data/vlsi/open_pdks/sources/sky130-pdk/env/conda -b -f PREFIX=/data/vlsi/open_pdks/sources/sky130-pdk/env/conda Unpacking payload ... bash-4.2$ echo $? 1 bash-4.2$ du -s /data/vlsi/open_pdks/sources/sky130-pdk/env/conda 307012 /data/vlsi/open_pdks/sources/sky130-pdk/env/conda

Expected behavior or outcome

When a non-zero exit status is returned from any program an error is given so the user has feedback about the cause of the error (unless the same user has overridden such behaviour explicitly where that capability exists).

Conda info

$ conda info
bash: conda: command not found
### This bug report is above the environment and concerning the installer shell-archive.

Conda config

$ conda config --show-sources
bash: conda: command not found
### This bug report is above the environment and concerning the installer shell-archive.

Conda list

$ conda list --show-channel-urls
bash: conda: command not found
### This bug report is above the environment and concerning the installer shell-archive.

Additional information

This bug report is with the Miniconda3-latest-Linux-x86_64.sh installer exit status.

dlmiles commented 1 year ago
# original issue report:
# https://github.com/ContinuumIO/anaconda-issues/issues/11148
# First try to fix it (this apparently didn't work; QA reported the issue again)
# https://github.com/conda/conda/pull/9073
mkdir -p ~/.conda > /dev/null 2>&1

This mkdir errors, but the message goes to /dev/null and the script is set -e so any command error result in termination of the shell-archive execution with no message as to why.

Miniconda is working inside a docker and does not have permission to write to $HOME/.conda due to the way it is setup.

Either this mkdir should not abort the installation set +e; mkdir ...; set -e or mkdir ... || true ? or the message must be shown. Bug in the comment description nearby talks of race condition, so maybe test -d ~/.conda || mkdir -p ~/.conda 2>/dev/null || test -d ~/.conda || mkdir ~/.conda mkdir not work, if it is trying to defeat a race. It surprises me after all these years the 'mkdir' tool does not have an option for this use case, to simply ensure a directory exists on exit or error, managing any race to create situation (and accepting the directory may already exist).

https://github.com/conda/constructor/blob/main/constructor/header.sh#L439

Referencing for cross-reference https://github.com/conda/conda/pull/9073 https://github.com/conda/conda/pull/11148

Bug was originally (incorrectly filled) in the project where the header.sh file is located at https://github.com/conda/conda/issues/12642

Further more, this install was driven by a conda.mk (Makefile) I am not sure if this is part of the standard Miniconda or part of the other project consuming Miniconda. This makefile downloads with wget the shell script Miniconda3-latest-Linux-x86_64.sh and performs the installation. When restarting the make process a 2nd time, it does not complete the installation where it left off, nor does it error again at the same point, so it appears to completely skip the parts of the script that occur after the exit point due to 'mkdir' failing. Maybe there should be a flag file laid down in the make situation that confirms it completed the install without error, causing the next run of make to restart the installation again and get the same error. Because the installation success flag file does not exist. Please advise if this is an issue here or with the way it is used in the consuming package.