Skip to content

Commit

Permalink
dev.sh: remove files carefully
Browse files Browse the repository at this point in the history
When expanding variables to pass to `rm`, make sure that the path
variable is set and fail if it is not.  This prevents an `rm` from
accidentally expanding to `rm ""/*` when the variable is unset:
ValveSoftware/steam-for-linux#3671

Using `${FOO:?}` syntax will fail when `FOO` is unset.
  • Loading branch information
ethomson committed Feb 19, 2019
1 parent ee5bd86 commit e75b1e0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,13 @@ function package ()

heading "Packaging ${agent_pkg_name}"

rm -Rf "${LAYOUT_DIR}/_diag"
rm -Rf "${LAYOUT_DIR:?}/_diag"
find "${LAYOUT_DIR}/bin" -type f -name '*.pdb' -delete

mkdir -p "$PACKAGE_DIR"
rm -Rf "${PACKAGE_DIR:?}/*"

pushd "$PACKAGE_DIR" > /dev/null
rm -Rf *

if [[ ("$CURRENT_PLATFORM" == "linux") || ("$CURRENT_PLATFORM" == "darwin") ]]; then
tar_name="${agent_pkg_name}.tar.gz"
Expand Down

0 comments on commit e75b1e0

Please sign in to comment.