-
Notifications
You must be signed in to change notification settings - Fork 30
fix: fix env escaping #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* Avoid adding extra : characters to the end of gcc paths. This will cause gcc to use the current directory in system include paths, which breaks C #include <file> vs #include "file" semantics. heroku/heroku-buildpack-apt@c8c021e
CACHED_TAR="${FREETDS_CACHE_DIR}/freetds-${FREETDS_VERSION}-heroku.tar.bz2" | ||
if [[ "$CACHED_STACK" != "$STACK" ]] ; then | ||
topic "Stack has changed. Clearing cache" | ||
rm -f "$CACHED_TAR" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🆕
# Default rebuild to true since I'm having issues linking the library to tiny_tds gem with a cached build. | ||
if [ "${FREETDS_REBUILD:-}" = "true" ]; then | ||
FREETDS_CACHE_DIR="$CACHE_DIR/freetds/cache" | ||
mkdir -p "${FREETDS_CACHE_DIR}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new namespaced directory
fi | ||
# Ensure we store the STACK in the cache for next time. | ||
mkdir -p "$CACHE_DIR/.freetds" | ||
echo "$STACK" > "$CACHE_DIR/.freetds/STACK" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new, cache reference to stack.
# shellcheck disable=SC2034 | ||
ENV_DIR="${3}" | ||
# echo "$STACK" | ||
# echo "$SOURCE_VERSION" | ||
# See https://devcenter.heroku.com/articles/buildpack-api#bin-compile-summary | ||
|
||
mkdir -p "$BUILD_DIR" "$CACHE_DIR" | ||
# Store which STACK we are running on in the cache to bust the cache if it changes | ||
if [ -f "${CACHE_DIR}/.freetds/STACK" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new, cache everything in a .freetds directory
mkdir -p "${BUILD_TARGET_DIR}" | ||
|
||
# This is the path that will be used at dyno runtime, and in which we build. | ||
APP_TARGET_DIR="/app/freetds" | ||
APP_TARGET_DIR="${HOME:-app}/.freetds" # /app/freetds" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new: always home, always in .freetds
@@ -84,44 +136,51 @@ configure_app_env_vars() { | |||
# These exports must point to /app, because the profile is | |||
# executed in a running dyno, not the buildpack environment | |||
cat <<EOF > "${BUILD_DIR}/.profile.d/freetds.sh" | |||
export PATH="${APP_TARGET_DIR}/bin:\$PATH" | |||
export PATH="\${HOME}/.freetds/bin:\$PATH" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new, always escape, always use home
export LIBRARY_PATH="${APP_TARGET_DIR}/lib:${LIBRARY_PATH:-/usr/local/lib}" | ||
export SYBASE="${APP_TARGET_DIR}" | ||
export FREETDS_DIR="\${HOME}/.freetds" | ||
export LD_LIBRARY_PATH="\${HOME}/.freetds/lib:\${LD_LIBRARY_PATH:-}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new, always escape, no more fallback when empty
# Assert $APP_TARGET_DIR = $HOME/.freetds # /app/freetds | ||
export PATH="${HOME}/.freetds/bin:$PATH" | ||
export FREETDS_DIR="${HOME}/.freetds" | ||
export LD_LIBRARY_PATH="${HOME}/.freetds/lib:${LD_LIBRARY_PATH:-}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new, always use home
# give environment to later buildpacks | ||
export | grep -E -e ' (PATH|LD_LIBRARY_PATH|LIBRARY_PATH|FREETDS_DIR|SYBASE)=' > "${LP_DIR}/export" | ||
export | grep -E -e ' (PATH|LD_LIBRARY_PATH|LD_RUN_PATH|LIBRARY_PATH|FREETDS_DIR|SYBASE)=' > "${LP_DIR}/export" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new, use LD_RUN_PATH
|
||
echo "configured BUILDPACK env vars:" | indent | ||
indent < "${LP_DIR}/export" | ||
|
||
topic "Rewrite package-config files" | ||
find "$BUILD_DIR/.freetds" -type f -ipath '*/pkgconfig/*.pc' | xargs --no-run-if-empty -n 1 sed -i -e 's!^prefix=\(.*\)$!prefix='"$BUILD_DIR"'/.freetds\1!g' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new from heroku-aptfile-buildpack. not sure if important
Fixes