Skip to content

Commit

Permalink
{de,}activate: Do not use IFS to find scripts to source
Browse files Browse the repository at this point in the history
Unfortunately this change would remain active afterwards and
this meant that normal variable delimiting did not work, so if a
script set CFLAGS="flag1 flag2", that value would be treated as
a single argument when passed to the compiler.

Instead `eval` and `find -exec echo` are used

{de,}activate
  • Loading branch information
mingwandroid authored and kalefranz committed Jan 9, 2017
1 parent 64d6d7d commit c4bd227
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion shell/activate
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ if (( $? == 0 )); then
# Load any of the scripts found $PREFIX/etc/conda/activate.d AFTER activation
_CONDA_D="${CONDA_PREFIX}/etc/conda/activate.d"
if [[ -d "$_CONDA_D" ]]; then
IFS=$(echo -en "\n\b")&>/dev/null && for f in $(find "$_CONDA_D" -iname "*.sh"); do source "$f"; done
eval $(find "$_CONDA_D" -iname "*.sh" -exec echo source \'{}\'';' \;)
fi
else
return $?
Expand Down
2 changes: 1 addition & 1 deletion shell/deactivate
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ if (( $? == 0 )); then
# Inverse of activation: run deactivate scripts prior to deactivating env
_CONDA_D="${CONDA_PREFIX}/etc/conda/deactivate.d"
if [[ -d $_CONDA_D ]]; then
IFS=$(echo -en "\n\b") && for f in $(find "$_CONDA_D" -iname "*.sh"); do source "$f"; done
eval $(find "$_CONDA_D" -iname "*.sh" -exec echo source \'{}\'';' \;)
fi

# get the activation path that would have been provided for this prefix
Expand Down

0 comments on commit c4bd227

Please sign in to comment.