From 8a5f52de3df220f7f4e1bab73cafc4b6b0925f0c Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 14 Sep 2020 20:59:01 -0700 Subject: [PATCH] dev/core#1393, dev/core#1990 - Assert that Drupal-style tarballs have no symlinks --- distmaker/dists/backdrop_php5.sh | 1 + distmaker/dists/common.sh | 12 ++++++++++++ distmaker/dists/drupal6_php5.sh | 1 + distmaker/dists/drupal_php5.sh | 1 + distmaker/dists/drupal_sk_php5.sh | 1 + 5 files changed, 16 insertions(+) diff --git a/distmaker/dists/backdrop_php5.sh b/distmaker/dists/backdrop_php5.sh index 65d8fb899d..59f85c14e1 100644 --- a/distmaker/dists/backdrop_php5.sh +++ b/distmaker/dists/backdrop_php5.sh @@ -28,6 +28,7 @@ dm_install_cvext com.iatspayments.civicrm "$TRG/ext/iatspayments" # gen tarball cd $TRG/.. +dm_assert_no_symlinks civicrm tar czf $DM_TARGETDIR/civicrm-$DM_VERSION-backdrop.tar.gz civicrm # clean up diff --git a/distmaker/dists/common.sh b/distmaker/dists/common.sh index cf6bcd9350..dc2cd9a65a 100644 --- a/distmaker/dists/common.sh +++ b/distmaker/dists/common.sh @@ -10,6 +10,18 @@ function dm_reset_dirs() { mkdir -p "$@" } +## Assert that a folder contains no symlinks +## +## ex: dev/core#1393, dev/core#1990 +## usage: dm_assert_no_symlinks +function dm_assert_no_symlinks() { + local SYMLINKS=$( find "$1" -type l ) + if [ -n "$SYMLINKS" ]; then + echo "ERROR: Folder $1 contains unexpected symlink(s): $SYMLINKS" + exit 10 + fi +} + ## Copy files from one dir into another dir ## usage: dm_install_dir function dm_install_dir() { diff --git a/distmaker/dists/drupal6_php5.sh b/distmaker/dists/drupal6_php5.sh index 2ecb1a2b14..6c9d94cc78 100755 --- a/distmaker/dists/drupal6_php5.sh +++ b/distmaker/dists/drupal6_php5.sh @@ -28,6 +28,7 @@ dm_install_cvext com.iatspayments.civicrm "$TRG/ext/iatspayments" # gen tarball cd $TRG/.. +dm_assert_no_symlinks civicrm tar czf $DM_TARGETDIR/civicrm-$DM_VERSION-drupal6.tar.gz civicrm # clean up diff --git a/distmaker/dists/drupal_php5.sh b/distmaker/dists/drupal_php5.sh index 7245be3fe8..64e5f9aa4b 100755 --- a/distmaker/dists/drupal_php5.sh +++ b/distmaker/dists/drupal_php5.sh @@ -28,6 +28,7 @@ dm_install_cvext com.iatspayments.civicrm "$TRG/ext/iatspayments" # gen tarball cd $TRG/.. +dm_assert_no_symlinks civicrm tar czf $DM_TARGETDIR/civicrm-$DM_VERSION-drupal.tar.gz civicrm # clean up diff --git a/distmaker/dists/drupal_sk_php5.sh b/distmaker/dists/drupal_sk_php5.sh index b375d2ad28..4419053ac0 100755 --- a/distmaker/dists/drupal_sk_php5.sh +++ b/distmaker/dists/drupal_sk_php5.sh @@ -36,6 +36,7 @@ rm -rf $TRG/packages/tinymce # gen tarball cd $TRG/.. +dm_assert_no_symlinks civicrm tar czf $DM_TARGETDIR/civicrm-$DM_VERSION-starterkit.tgz civicrm # clean up -- 2.25.1