Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#8 (comment)
parent=$(ps -o comm $PPID |tail -1)will break docker build witherror: process ID out of rangeif/bin/shis actuallybashorbashis explicitly used.Reason:
RUN ["/bin/bash", "-c", "/bin/bash <(curl -L micro.mamba.pm/install.sh)"]will cause the shell environment has$$=1and$PPID=0.As discussed in https://stackoverflow.com/questions/77524391/ppid-behavior-of-bash-c-and-dockerfile-run , https://stackoverflow.com/questions/67827986/why-is-bash-handling-child-processes-different-compared-to-sh, https://stackoverflow.com/questions/76310409/does-bash-promise-to-optimize-c-into-plain-exec-in-simple-cases, and https://unix.stackexchange.com/a/466523/537347,
bashwill introduce optimization thatexecthe last command and make$$=1(considering the PID namespace mechanism of container).RUN ["/bin/bash", "-c", "(/bin/bash <(curl -L micro.mamba.pm/install.sh))"](i.e. create a subshell) orRUN ["/bin/bash", "-c", "/bin/bash <(curl -L micro.mamba.pm/install.sh); exit"]can work.It seems that we should fallback to
$$if$PPIDis not exists of is not a compatible shell.As discussed in #8 (comment), for non-POSIX compliant shell for example
fishandxonsh,install.shmight be executed bybashorsh. Thus we cannot use$$by default.However, using
$PPIDinstead of$$does introduce counter-intuitive behavior: runzsh <(curl -L micro.mamba.pm/install.sh)in abashwill initbash.Instruction in the documentation (and README of this repo)
"${SHELL}" <(curl -L https://micro.mamba.pm/install.sh)does NOT always usesh, suggesting that"${SHELL}"will be initialized (but actually NOT). And there isn't any remark/note around this instruction.Nonetheless, allow something like
INIT_WHICH_SHELL(in{bash,cmd.exe,dash,fish,posix,powershell,tcsh,xonsh,zsh}) to be set before the script is run to facilitate non-interactive installation can be really helpful.cc @AntoinePrv